Thanks for reaching out. If I understand correctly, let’s say you have some simple records like this:
"name": "Kohler Toilets Seat"
"name": "Kohler Toilets"
"name": "Kohler Toilets Lever"
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?