Use union of query search and filters


in our project, we have Algolia search integrated through React Instantsearch library.
If I use fulltext query, e.g. Panasonic and use a facet filter with attribute brand with value Sony, it creates intersection (query AND filters=“brand:Sony”), which result in zero results. We need to show union: (query OR filters=“brand:Sony AND price:1959…etc.”)

Is it possible to use query in union with other filters?

Best regards,

The query is the core of how Algolia search works – everything else is a refinement on top of it, so you can’t OR the query results.

If you want to include results for a category/facet as well, you can use the multi-index search to perform an additional search against the same index with the brand filter and an empty query.

Then you can display the results from both queries. You could take this a step further and only show the brand results if you don’t get back any query results by using a no results page:

Thanks! But this means I will probably get duplicate results if some of the results contains both keyword from query and brand filter, am I right?