Exact Product Name and not products with the exact name in it

Hi all,

I am stumped on this and I have tried numerous settings and rankings to try and fix this.
The issue is the following.

A user types in “Kohler Toilets”

It will show all the parts for “Kohler Toilets” first instead of just the actual toilets which the client wants to come up first.

Is there any settings where I could give that more prelevance if a subject actually matches and just doesnt contain the name of the part in the product name.

Thanks for any hints or tips anyone has.

Hi @mick,

Thanks for reaching out. If I understand correctly, let’s say you have some simple records like this:

   "name": "Kohler Toilets Seat"
   "objectID": 3
   "name": "Kohler Toilets"
   "objectID": 2
   "name": "Kohler Toilets Lever"
   "objectID": 1

When you query "kohler toilets" you would want the actual “Kohler Toilets” only to show as the first result - in our example this is objectID 2. Is that correct?

Understanding Algolia: The reason all three (3) records return as relevant is because they all include the words “Kohler” and “Toilets”. The “exact” ranking criterion only looks for the existence of the words “Kohler” and “Toilets”, without typos - but not whether they are the only words in a searchable attribute. Read more here

Therefore, according to the tie-breaking algorithm each of these three are equal for textual relevance. The tie-breaker of last resort is objectID descending.

How you might achieve your goal:

  • Manually Change objectID: A simple but doable approach is to manually adjust the objectID. Make the objectID for the “Kohler Toilets” actual toilet higher so that it is returned first in the results.

  • Enrich with another attribute: An alternative is to consider any additional attribute that can be used to differentiate the “actual” product. For example, a boolean isPart: true/false or isActualProduct: true/false - your pick. Then if you set this in your records you can custom rank with desc(isActualProduct) so that all true (value 1) records like the actual Kohler Toilets are ranked higher.

This is not to say these are the only methods. However, I hope that with this inspiration you can see that by adding or changing the records you can use attributes to your advantage.

How does this help you?