Querying against multiple indexes and dealing with pagination

I am writing a new search results page for a site that uses Algolia, where there are 4 separate indexes - one for the main www website, one for the blogs website, one for the documentation website, and one for the forums website. Currently, search on each respective website searches the appropriate index, and all works well.

The new feature I am building is that on the search results for the www website, I need to be able to include results from the other 3 indexes, with business logic like:

Show a max of 8 total results per page of results.
If all 4 indexes return results for the search, show the top two of each.
If one of the indexes does not have results for the given page of results, then show more from the other indexes.

If a user navigates to page 3 of the results, and only one of the indexes had enough results to make it to page 3, then I will need to show the next 8 results of the given index.

In this scenario, what is the best way to handle pagination when multiple indexes are at play? Does Algolia offer any support for such a scenario, where I want to treat the 4 index as one collective index? Do I need to implement this custom pagination logic on my own?

Any help is greatly appreciated!



Hi Jude,

Thanks for reaching out to Support.

I spoke with the Customer Success Manager for your account and confirmed that you have dedicated support so I suggest you reach out to your team and schedule a call directly to discuss this Multi-Index (Federated) Search implementation. You may also find the docs below helpful for getting started.

Best regards,