Closed alexc-wormhole closed 2 years ago
Hey @alexc-wormhole, have you tried to make a bool query? Not sure if this is exactly what you need, but maybe it drives you in the right direction:
$config = Query::bool()
->must(
Query::multiMatch()
->fields (['type', 'label', 'description', 'canonical', 'property', 'building', 'location',])
->query ('*'.$request->get ('q').'*')
)
->filter( // you can also use should instead
Query::term() // you can use match instead
->field('property_id')
->query('12345')
);
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
I am searching 10+ indexes at once for the same keyword. However, i need to return only the results a user is authorized to view.
Each of these have a "property_id" key attached to them on the ES index. The eloquent models do not have this key.
Here's the query itself:
Which i then use like so:
Finally getting it with this:
Ideally i need to use one of these to constrain the query on each index to the results tagged with a specific (parent) property_id to avoid users receiving search results they're not entitled to see.
Adding it to SearchQuery() generates an exception. Is there a better way to constrain multi-index queries where you need to search multiple fields?
P.S. Amazing package man, thanks for creating it.