How to Multiqueries on different indexes when using custom searchClient on angular-instantsearch when querying backend server

I am using Angular-instantsearch and algolia java client, I’ve not been able to found doc on angular-instantsearch on how to make Multi Queries on different index. I manage to do it well on my back end in java , with different preset search param ect.

What i ve found for now is some doc on the instantserach.js. For making multiqueries : - Multiple instance of InstantSearch sinced with a Main index (problem is with Instantsearch.js i can’t override the SearchClient to root to my backend instead of algolia servers) - In angular-instantsearch ,i can override the searchClient, but dunno how to add multiple instance of instantsearch.

What i would like to do:
-Either make a custom ais-instantsearch that handle multiqueries ( multiple indexes) -Or a middleware service , that take my indexes list + query then query my server , and finally dispatch the result to my custom Hits component. -Or something else if you have another idea .

There is my actual config of ais-instantsearch, using my backend server (which is working fine) and consitencyService to manage when to display or not the results in my hit component. The problem is even if i send back multiple results , my hit take only 1 result set.

this.searchConfig = {
indexName: ‘locations’,
searchFunction: (helper) => {
if (helper.state.query === ‘’) {
searchClient : {
search : (requests : SearchRequest): Promise<{results: SearchResponse}> => {
if (this.indices instanceof Array) {
this.indices = this.indices.join(’,’);
let query;
if ( this.consistencyService !== undefined && this.consistencyService !== null) {
query = this.consistencyService.query;
, JSON.stringify(query === undefined ? {requests} : {query: query})
, {headers: {‘Content-type’: ‘application/json’}}).map(response => {return {results: response}}).toPromise();

Thanks for your time, hope someone can help.

Hey there,

What are you trying to do with multi indexes?

You can read this guide on using a custom backend with Angular InstantSearch.

I have a general search bar that must query over 4 indexes at least to display different types of items.

I’ve read it, but i couldn’t found any way to use Multi Queries with custom backend in Angular-instantsearch.

Precisely i couldn’t find a way to derivate the Helper of the Instantsearch instace generated by ais-instantsearch component. Which result in the fact that to achieve multi queries i would need multiple instance --> and so multiple call on my network for only one ‘real’ query.

Anyway i’ve managed to bypass the restriction of 1 instance - 1 hit component by adding a custom Service and removing the ‘hits widget’. The filter on the query being set un backend (for security matters).

If there is a more natural/clean way of doing this, i ll be more than happy to ear about it.

Thanks by advance.