Implement multi-index search
bidoubiwa opened this issue · comments
Fixed by: #888
Currently instant-meilisearch
does not support the Index
widget.
After some research we discovered that the Index widget does not imply merging the search results of multiple index but instead return them in two separate lists (See this guide of instant-search).
Thus, we are able to implement it with a small work-around where we make multiple search request.
@bidoubiwa is there any ETA for this? Perhaps 0.29? 🤔 really thank you for your amazing work!!
Hey @Tragio ! I will keep you updated as soon as I have a better idea on when I will be implementing this :)
Hi, just wanted to see here if there was a possible work around to be able to do the multi index search, even if it returns in different lists? I wasn't able to figure out how to natively trigger multiple index searches from a single query. Thanks :)
Edit: found a hacky way to do it. Just instantiated new instant search for each different index, then attached an input event listener to the instantsearch searchbox, and manually searched across many indexes
document.getElementsByClassName('ais-SearchBox-input')[0].addEventListener('input', function () {
const value = document.getElementsByClassName('ais-SearchBox-input')[0].value
search_index_1.helper.setQuery(value).search()
...
})
I attach the searchbox widget to one index, and manually search the rest (otherwise searchbox won't appear)
The multi-index search beta is released! Can you try it out? It is published on npm here
Released on the latest dist tag on npm 🔥