Perfect match vs exact match on multiple words

Hi guys, I’ve got an issue trying to prioritize searches with a perfect match over exact match on multiple terms.
My index defines only a searchable attribute called name.
My ranking formula right now is the default Ranking Criteria followed by a custom ranking attribute counter (ordered desc) that contains an integer (website number of results for that term).

Typing “ecografia ginecologica
I would like to prioritize record with name = “Ecografia ginecologica” (perfect match with counter = 45) over other records with the same words plus others like “Ecografia ginecologica 3D” (with counter = 65).

Looking at the Ranking information I can see that default Ranking criterias are exactly the same for the two items (matching on the first word, exact words count, proximity distance, typos, matching words, etc) so the two items are prioritized by the counter attribute which gives me that undesired result.
I tried to customize the ranking formula and also to reset it to defaults but it didn’t solved.

I was thinking about adding an extra attribute words_count to my item trying to prioritize records with “short” names (sorting asc) but it would interfere too much with the counter attribute since I only want to priorize the perfect match over other results. In ElasticSearch I would implement another not_analyzed field to execute this kind of match but I’m not sure it’s possible on Algolia.

Anyone tried anything like this? Any ideas?

Hello @Dottori.it,

Most of the time, what matters most is the number of words matched, the proximity between matched words and how close to the beginning of the attribute the matches are. In your case, all of those criteria rank equal, which explains why the custom ranking is taken into account.

We do have an “exact” criterion, but it only applies to one-word attributes.

So I am afraid we have no easy solution to this specific problem… :frowning:

Salut Clement! We are encountering a similar situation .See this example here where I try to search for pages on the 3DS XID, but I get all other pages except the ones having exact match for “XID”. Do you have any plans to work our exact match on multiple keywords queries?

Is this still not possible?

As an example if you search “macbook air”, the results are

  1. macbook air charger
  2. macbook air case
  3. macbook air sleeve
  4. macbook air adapter
  5. macbook air

There has to be a way to get the exact phrase (#5) at the top or de-rank results with words that do not match the query at all.

3 Likes