Listing results based on Fav, Anti fav and then without flags on first load

Hi Team,

I need help with displaying results on the first load.
I have 3 different flags i.e. Fav, Anti-fav and without any flags.
My task is to display the results on the first load in the following manner:
First, all posts who have flag “Fav”
Then all the posts with the flag as “Anti-fav”
and then all the posts with “No flag”.

I want this result only at the first load.

Any suggestions on how to implement this with instant-search?


You could replicate your index to have two, related versions of the same data. One would be ranked according to you “Fav”, “Anti-Fav” and “No Flag” criteria and the other one without this ranking. Then, based on if the user is doing an initial search or any other you could target the right index.

There is some documentation there about replicas:

Hope this helps!