sngrl / sphinxsearch

Sphinx Search for Laravel 5
MIT License
124 stars 89 forks source link

Filter using array? #25

Closed harunB10 closed 7 years ago

harunB10 commented 7 years ago

I have a country field and array of searchableCountries.

$searchableCountry = explode(",", Input::get('searchableCountry'));
if ($searchableCountry != null) {
            $results = $cl->Filter('country', [$searchableCountry]);
        }

However, when I search using single string it works:

$country           = Input::get('country');
if ($country != "" || $country != null) {
            $results = $cl->Filter('country', [$country]);
        }
harunB10 commented 7 years ago

Problem was with the [] brackets... I should have used:

if ($searchableCountry != null) { $results = $cl->Filter('country', $searchableCountry); }