I’m using Algolia.Search library for .Net version 6.6.0. We decided to implement different sorting strategies on the project. I found that virtual replicas is what we need for that.
In the code I’ve assigned a list of names to
Replicas property in the IndexSettings class. It works. But I have to change SortBy attribute on every replica manually on the Dashboard after that.
Is there any posibility to assign
Ranking property for replicas from the code?
You should be able to change the sorting/ranking on the virtual indices programmatically by iterating through each virtual index and calling SetSettings. Here’s a code sample in C#:
SearchIndex replica_index = client.InitIndex("products_virtual_price_desc");
IndexSettings settings = new IndexSettings
CustomRanking = new List<string>
The code is taken from this page, which has further details around creating/configuring replicas:
Thank you for the reply. Unfortunately, we can’t use virtual replicas therefore
CustomRanking propety is not an option for replica settings. According to the guide I should use
Ranking property for standard replica settings. Correct?
That’s correct – for standard replicas just use the example that includes