On a search page (Search API view with some facets) we are using panels to display some more views below the main search view ("view #1"). For better performance some of these additional views display data from the same search index as "view #1" (e.g. one view simply lists latest content).
While adding these views we noticed they are filtered automatically using the facets from "view #1" even if we configure the facets to be active for specific search IDs (by excluding the other views).
In SearchApiFacetapiAdapter::initActiveFilters() the setting is respected but in SearchApiFacetapiTerm::execute() all active facets are added to the current query without checking the facet option "facet_search_ids".
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2128947-2--disabled_facets_multiple_searches.patch | 1.5 KB | drunken monkey |
| #1 | respect_search_api_facets_search_ids-2128947-1.patch | 1.21 KB | stborchert |
Comments
Comment #1
stborchertWith the attached patch, the facet is not added to a views query if the facet is configured to be inactive for this view.
Comment #2
drunken monkeyThanks for reporting this issue, and even providing a patch for it!
It already looks pretty good, doesn't seem to affect normal functionality and if it works for you to resolve the issue then that's great.
Just two little style fixes: the settings for the facet are already retrieved earlier in that method, and the two conditions can actually be easily written as one. Please see if the attached patch still works for you and I'll commit it in a few days (in case someone else wants to review).
The reason we're currently not doing this is that I thought the Facet API would automatically take care of it. Seems this is not the case, so let's just add it.
Comment #3
stborchertHi Thomas.
Thanks for reviewing and improving the patch. It's still working so I set the issue to RTBC ;)
Comment #4
drunken monkeyThanks for reviewing again, good to hear it still works.
Committed.
Thanks again for the great patch!