babenkoivan / elastic-scout-driver-plus

Extension for Elastic Scout Driver
MIT License
267 stars 52 forks source link

Using scope in queries. #80

Closed peektoseen closed 3 years ago

peektoseen commented 3 years ago

Hi all! When I use elastic-scout-driver - I can add model scopes to the result, like this:

$elements = Book::search('food')->query(function ($query) {
    return $query->BySubscription()->ByData();
})->paginate(
    24
);

But what If I need using elastic-scout-driver-plus with boolSearch ? Is exist some method for do it?

babenkoivan commented 3 years ago

Hey @peektoseen, query is currently not supported by elastic-scout-driver-plus.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Stalex89 commented 2 years ago

@babenkoivan Hello, may I ask if this feature is expected in the nearest future ? I really need it for my project

I have users with subscriptions, and I need to filter users with no active subscription out of elasticsearch query. I have a scope with eloquent relation, but I cannot use it together with searchQuery.

Thank you in advance!

babenkoivan commented 2 years ago

Hey @Stalex89 and @peektoseen, you can use the refineModels method as described here.