Closed marksparrish closed 6 years ago
Looks like this may work better - https://stackoverflow.com/questions/39541603/how-can-you-set-boosts-and-filters-with-laravel-scout-and-elasticsearch.
Create your own by forking/extending the current driver.
+1 here. Can't use Scout because of the very limited where system, I'd love to be able to set a much greater number of filters.
You can achieve this with the callback. I have checked for Elastic, but it should be similar to what we do with Algolia:
$moreOptions = [....];
Model::search($query, function ($algolia, $query, $options) use ($moreOptions) {
$options = array_merge($options, $moreOptions);
return $algolia->search($query, $options);
})
If your Scout is up to date, you can create a macro to keep it simple. You can find an example here.
Although, I agree it would be great to have a with
method to do it easily.
Model::search($q)->with($extra)->get();
@julienbourdeau that will work great for the time being, but I would love to see the filters get more functionality like the query statements in Eloquent. Mapping an array to $key.'='.$value
seems lazy.
You could now use https://github.com/algolia/scout-extended which has this functionality.
I would like to be able to pass an additional parameter on search method.
Currently you only pass the string you want to search for -
$orders = App\Order::search('Star Trek')->get();
However it would be nice to pass an additional parameter after the string -