Query "word" containing full stop

Dear all

Our users would like to query something like “XXX.12334”. In this case “XXX.12334” is a unique identifier of an item that they are searching for. Problem is that we get a lot of false positives because the full stop “.” implies that algolia is indexing two words i.e. XXX and 12334. Is ity possible ()perhaps using query rules) to identify when “XXX” appears in the query and then not to split “XXX.12334” into two words?

Best Jens

Hi @jmad,

Thanks for your message!

Assuming that there is a dedicated attribute for this ID value and that typo-tolerance is not required for this use case, the easiest solution is probably to use query rules:

  1. Set the attribute as a facet by adding it to the the attributesForFaceting index setting;
  2. Create a dynamic faceting query rule which is triggered when matching a value of this attribute/facet, and the consequence of which is to apply a filter on this facet value; this is described in more detail in this tutorial (where color would be replaced by the name of your ID attribute).

Let us know if this doesn’t address your issue or if you need any further help!



Dear Alexandre

Thank you for your help. What you suggest is not exactly what i was looking for. If understand the tutorial you linked to I will only search in the dedicated attribute? What I would like to do is to stop splitting on full stops in all attributes once I recognize “XXX”.

Is that possible?


Hi Algolia

This thread got really quiet… :slight_smile: Do you know of a solution?

Best Jens

Hi @jmad, searching for IDS is a tricky subject but here’s another way to deal with it that we recommend. If you know that people will search for either “XXX.1321” or “XXX 1321” and what they mean is actually the product ID “XXX.1321” then the best way is to use alternatives products ids so that your objects are like:

{objectID: .., productID: XXX.1321, alternateProductIDs: [XXX 1321]}

This way, combined with disableTypoToleranceOnAttributes API parameter | Algolia on the product IDS references might give you better results here.

Prefix searching | Algolia can also be a good candidate to try out.

Let us know how it goes and sorry for the late reply. As said, this is a community forum and per se there’s no guarantee on our response time.