-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pass additional parameters on search method #198
Comments
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 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 |
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 -
The text was updated successfully, but these errors were encountered: