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.

Comments

lalweil created an issue. See original summary.

mikemadison’s picture

mikemadison’s picture

Adding related issue, because we are also seeing some of the various region behavior as outlined in https://www.drupal.org/node/2273159

drunken monkey’s picture

Component: General code » Facets
Status: Active » Needs review
StatusFileSize
new3.59 KB

This 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).

mikemadison’s picture

Thank 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?

mikemadison’s picture

As 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!

mikemadison’s picture

Status: Needs review » Reviewed & tested by the community

  • drunken monkey committed 02041b1 on 7.x-1.x
    Issue #2700011 by drunken monkey: Fixed compatibility issues of facets...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Great to hear, thanks for testing!
Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.