Ranking Formula, ranking by a string field

I noticed in Algolia when reordering items to be above the regular “Ranking Criteria” that you cannot use a field that contains string values:

How can you rank your results strictly alphabetically against a string field?

1 Like

Hi @mattucci,

Using a string attribute as sort-by is indeed not possible.

The best you can do here is add the rule as first rule of the custom ranking.

If you are only interested in ordering on the first char of the results, you could also pre-compute the char index and add an attribute charIndex and use that as sort by strategy.

I hope that helps,

1 Like

Thanks @rayrutjes that helps :slight_smile: thank you!

1 Like