Get results from all indexes with multi index search
Feature ⚡️
What is your use case for such a feature?
I use multi index search with one main index and two secondary indexes. I used the implementation proposed in the documentation here : https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/multi-index-search/vue/#hits-from-multiple-indices
When I want to detect if a query has results I tried to catched hits with the ais-state-results component but it only react with main index results. If I have two hits in each secondary indexes and zero hits in the main index, ais-state-results will return zero hits.
Or I want to display a message when a query has no results for all indexes. I there a native solution for that problem ?
What is your proposal
Use an array of indexes in the ais-instant-search props "index-name" for multi index search and aggregate all results in the ais-hits
or
React with all ais-index and ais-state-results and not only with the main index
What is the version you are using?
vue-instantsearch v3.4.3
That's a good point, ais-state-results should get access to the full results too (called scoped results). A solution is to use a custom widget like this: https://codesandbox.io/s/sad-currying-8ditm?file=/src/App.vue
Thank you very much for your quick answer 🙏 I tried your solution and it works well !
I just have a vue warning when I use it with Nuxt :
[Vue warn]: Multiple root nodes returned from render function. Render function should return a single root node.
Could you make a reproduction on codesandbox? this is likely related to a change you made from my example @victorgambert :)
This is an old issue, so I'll assume that it has been fixed in the mean time. If you have more issues, please open a new issue and give a reproduction. Thanks!