For specific queries: use only first 9 characters

Hi, I have a question regarding Algolia. We are building in Algolia into our Sitecore website and see that some users try to search for: ABCXXXXXX-123-456… This are random product codes that we don’t support in our website. This brings 0 results in the results page, which is normal. Is it possible to configure Algolia in the way that: IF a query like that is being used, just use the first 9 digits and remove the rest? Like: ABCXXXXXX, and search for that only? This will give the right results.

Thanks in advance!
P.

Anybody? Now i’m just adding lots of alternatives but that can’t be the right way… The product codes are also changing regulary, so we cannot just add them into our back-end. Any help / feedback is greatly appreciated.

So what I aim to do = If somebody searches for a specific product code, only search for the first 9 characters / digits and remove the rest. This will give us the right results.

Hmmm… if the customer is typing the product code, the results should show up as they type – I’m guessing in this case they’re just pasting the whole string and bypassing the “as-you-type” search?

I can’t think of a way to do this via index configuration – if the 9 digit strings are consistent you may be able to do something with a rule. Otherwise you’d probably want some client side code to detect that it’s a product code (maybe a regex) and trigger a search using the truncated string.

There are several tips for searching SKUs and other product codes here (things like making sure to turn off typo tolerance, etc). It talks a bit about how you can use rules to help steer intent:

hi Chuck, thanks a lot for your reply. I see what you mean by doing it via a rule, that could be a way. People indeed copy-paste the code into Algolia, bypassing the as-you-type search.

The first 8 characters we always know. It will be something like this: ABC12345 (3 letters followed by 5 digits).

Our issue is the following: After the 8 characters, attached to it (without space) there are 3 more characters. The complete string looks like this: ABC12345XXX-XXX-XXX. If the string would be just ABC12345-XXX-XXX. Then it would work. But Algolia can’t find any results for the ABC12345+the 3 digits attached to it. Do you know if there is any way to solve this? Thanks a lot for your advice

problem