I'm not positive where in the Search API stack this is happening, it could be a SOLR issue, it could be a Facet API issue (or even a Views issue).
I have a site that is using the Facet Blocks plugin for Views to create a set of persistent facets that appear on every page of the website and drive the user onto a /search page. This has been working well.
We are now setting up new views (based on another search index) that have other facets (sometimes a similar field) that sit in other regions on pages that overlap with the facets blocks.
Example:
Field A is a taxonomy (field_a) that is included in both Search Index 1 and Search Index 2. There is a field_a Facet in both indexes and on page_example the index 1 facet sits in the footer, while the index 2 facet sits in the sidebar.
In theory, given the video that is driving the page_example, the 2 facets should have similar, but different data. In this example, imagine that the facet for index 1 shows all data on the website, and the index 2 facet has a subset based on a filter within the view.
What we are experiencing on the site is that the two facets are interacting with each other as if they were part of the same view / index, as opposed to separate indexes / views that happen to be sitting on the same page.
I'm not sure if I'm asking for something that is even possible, but I was under the impression that it was.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 2700011-5--fix_different_index_facets.patch | 3.59 KB | drunken monkey |
Comments
Comment #2
mikemadison commentedComment #3
mikemadison commentedComment #4
mikemadison commentedAdding related issue, because we are also seeing some of the various region behavior as outlined in https://www.drupal.org/node/2273159
Comment #5
drunken monkeyThis seems to be due to problems in both this module and the Facet API. It seems some of our code for matching facets to queries was off – please see the attached patch.
However, this still doesn't fix the fact that active facets in the URL will (usually) be applied to all facets with the same name. That's simply because, once they're in the URL, there is nothing distinguishing a facet for one index or search from those for another.
This is a problem of the Facet API. To solve it, you'd probably have to switch the filters key (by default "f") that one of the searches uses, probably by providing an overridden Facet API URL processor or by doing something clever with alter hooks, setting a different filter key at the right moment. For the specifics, please ask in the Facet API issue queue (and then please test this patch here in combination with the solution for Facet API).
Comment #6
mikemadison commentedThank you sir, let me do a bit of testing.
I'm wondering if a potential work around for the like-named facets is to aggregate fields and facet on those, so that you don't have multiple facets with the exact same machine name on the same page?
Comment #7
mikemadison commentedAs far as I can tell, this patch resolves the problem instantly without a cache clear, re-index, or db update. Looks good to me.
THANK YOU!
Comment #8
mikemadison commentedComment #10
drunken monkeyGreat to hear, thanks for testing!
Committed.