Forcing an order for results (with or without ranking)

Hi there!

We have a requirement for our Algolia search to pass in a specific set of result ids and then return back the products exactly in that order (removing products if further filters are applied).


filters: [other filters] AND Id = 111 OR Id = aaa OR Id = 999 OR Id = bbb OR Id = 222 OR Id = 333

… should return appropriate matches in the same order (111, aaa, 999, bbb, 222, 333) assuming none are filtered out.

At the moment our index (correctly for every other use case) only returns products that match those ids but orders the results by a combo of default and our chosen ranking methods.

Is there a way of forcing an order based on an array of ids? Because of the desire for pagination we can’t sort the results once they’re returned to the front end.

Thanks in advance!