Synonym Query Expansion Problems

Our team of developers are trying to integrate the Algolia Search engine into our website and are working to add synonyms for different names for our product series and are finding that only a small portion of the synonyms are returning the results that we have applied as synonyms. For Instance, I have a product model called STXDe but, this model has alternative names such as: STXDeW06, STXDeW06C, STXDeW10, STXDe14RHUL, etc. When I try searching for STXDe14RHUL the results return negative for any search terms but, when I search for another item within the same synonym list it returns results. My question is whether there are restrictions to the synonyms query expansion table that could be blocking the search terms similar to the aforementioned item?

1 Like

Hi,

Thanks for reaching out!
There is no such restrictions on synonyms. But as stated in the doc:

While synonyms are powerful, their use can also lead to surprising or unexpected results, and should be used sparingly. For many use cases, simply including an attribute with an array of relevant keywords is a better alternative.
You can try the simpler approach of adding an attributes with relevant variations. If it doesn’t produce what you are expecting, contact our support and give us access to your indices so we can investigate further the issue :slight_smile:

Thank you for your response Karim. Can you elaborate on or provide an example of what you mean by adding an attribute with variations?

Sure! Something like that for products that you are indexing:

{
  "names": ["STXDe", "STXDeW06", "STXDeW06C", "STXDeW10", "STXDe14RHUL"],
  "name": "STXDe", //optional or just for UI purpose
  // other attributes of a product
}

In most of the case you will want to search for product by name and their alternatives, so you will need to use the names attribute. Adding the name attribute is useful to display the product in the UI or if you want to restrict the search on the main product name only.

Let me know if it’s clear! :slight_smile:

That makes sense. With each data record in the Indices I would set the “names” attribute under RANKING >> Searchable Attributes and set the “name” attribute under DISPLAY >> Attributes to retrieve for the UI on the Search Results page.

When uploading the new data records with the modifications will these records replace the existing records if they have the same objectID?