Instantsearch.js categories and global search

Hi all! I have tried to implement instantseach.js library (js version). I has successfully integrated it. I have several categories with products.

Each category contains:

instantsearch.widgets.configure({
   filters: "category_id = 3"
}),

as per algolia’s manual.

Also I have add searchBox module. When I’m inside category and try to use searchBox to search “some text to search” - I’m expecting, that search will look among all products, but it doesn’t. It only searches inside current category.

Could some one explain me, how I can fix it, so that searchBox works “globally” , not only inside category.

Thanks!

Your configuration is being set to ONLY filter on cat 3 off the bat, you should remove that from the configuration if you want the search to hit all products. When you want to filter for specific categories, you could do that at query time with instantsearch.search({filters: 'cat=3'}) maybe?

I’m understanding, that my configuration is set only to filter 3 products. So … example → I’m in “ice cream” category right now. There are 10 products. But I’m need to search for something other. (ie. as you know on the top of website, there are always “searchbox” which should search not only in this category, but globally).

So, for current category I NEED this filter for category ID, because I need to show only products from current category I’m in. But I’m as usual user expect to searchbox to search among all products. So some how I need to reset configuration filters when customer types in searchbox? And put back filter when searchbox is empty?

I’m curious if you could have multiple instances of your index, 1. for just the search, and 2. for the current page’s filter… Idk if this is helpful, but something like index | InstantSearch.js | Algolia