Combine 3rd parties search result with Algolia results


Is there a way to “enrich” Algolia search result with some 3rd party search result by requesting both datasource at search time. Then, merge the results together to have a seamless integration ?

Hi there,

As the title suggest, is it possible to combine 3rd party search results with Algolia search results (maybe using a custom widget with the InstantSearch api).

The use case is the following:

In our application we have two kind of data:

  1. Easily flattenable data with basic permissions access check (who can be addressed using Secured Virtual Api Key as suggested in Algolia documentation).
  2. Hierarchical, arbitrary deeply nested relational data, with custom permissions logic on each level of the hierarchy (files/folders tree like). This is not very easily flat-tenable, since any change on the permissions in the top level of the hierarchy can impact numerous element at the bottom.

While the 1st kind of data would be easy to keep in sync in terms of permissions between our DB and Algolia, the 2nd kind would require a lot more work, including:

To flatten the data:

  • Gathering for each “leaf” of our tree all the permissions inherited by the branches.

To keep the data in sync:

  • Listening on any event in the leaf branches which may have altered his permissions, re-gathering all the permissions for it, and updating the Algolia record accordingly, of course, for each leaf.

It doesn’t seem like a reasonable solution for us since each change may quickly lead to thousands of update on our Algolia flattened data.

Hence, we are wondering if there is a way to both, leverage Algolia search engine for the 1st kind of data. And then, use our own custom built endpoint on the 2nd kind of data.

Is there a way to integrate this 3rd parties datasource into the Algolia search engines on the frontend side ? Basically we would like to have the plugin making 2 queries, the 1st one to Algolia, and a 2nd one to our own search engine with a way to merge them together on completion.

I found my answer within “Backend InstantSearch” documentation page which seems to do exactly what we need (filter and enrich data from backend on our side).