Increase entry rating based on Array field

I have an index that contains a String array field that contains some of these possible values ["10-", "11-15", "16-18", "19-21", "22+"]. In my UI, the User can select these values and they expect to have the selected values to be presented first. For example, initially the user sees [A, B, C, D], where only D has "11-15" value in the String array field; when the user selects "11-15", the entries will be sorted to have D first [D, A, B, C].

My first idea was to have a replica to each situation, but it would mean managing 25 - 1 (31) indexes. What’s the best approach to have this result?

Hi Minoru!
If I understand correctly, if a user selects a particular facet value, the user expects to see records with that facet value first in the results set, and then see the rest of the records even though they do not match the selected value, is that right?

If so, our optionalFilters feature is probably the best way to go.

Optional filters allow you to “boost” records with matching filters without excluding all other records.

Filter scoring (if you would like “11-15”, then “16-18”, then …) might also be useful.

A couple of things to note:

  • Optional (and regular) filters rely on the filters ranking criterion, which by default is below typos criterion, geo criterion, and a few others. If you are looking for a “hard” placement of records matching particular filters, you may have to move the filters ranking criterion up in the ranking formula.
  • Depending on plan, there are different numbers of optionalFilters which can be applied.

Hopefully this helps. Let me know if I’ve misunderstood, or if you’re not seeing things work as expected.

1 Like