Score:0

Is it possible to have a Search API Facet to expand the results? Basically, querying this facet OR this facet?

ng flag

We have a Search API View (Solr) using facets and our nodes have two separate fields for the facets. One is an address field and the facet is built on the address US States and the other field is a text select list with values Virtual, Physical, National.

We need to build the facets in a way to allow the user to select a US State from facet 1 which narrows the results to node from that state.

Then, we need the second facet to also include nodes tagged as National even if they are not in the US state selected in the first facet.

It seems that the facets always narrow the results and I cannot find a way to make the facets work together as "this facet OR this other facet".

Score:0
mx flag

Search API "Or" Facet

I haven't tried this myself but there seems to be a Backend Search API feature search_api_facets_operator_or that fits with your description, although I don't know if it's available in all Drupal versions:

Search API Server backends and features

Regular Views Filters Or

Under "Filter criteria" in your views there is a dropdown arrow next to the "Add" button.

When you click it you will be able to see the And/Or Rearrange. This will open up the interface to group your filters into different groups (if necessary) and to change the Operator from And to Or.

quantumized avatar
ng flag
Thank you for the reply and I wish it was that easy but this is referring to Search API facets and not Views filters so this solution does not work for this case.
mx flag
Ah, right, it's been a while since I played with Search API and it didn't register. I'll adjust my answer.
quantumized avatar
ng flag
Thank you, I'll look through the doc you linked to (hadn't seen that one yet) but I have been experimenting with using search_api_query_alter() and it seems that the conjunction is locked at "AND" and I haven't been able to override that via code. Thanks again.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.