Product name with blank

Hi,
I need a solution for the following case:

Original product name: 123 45678910
If the user enters this data, results will be displayed.

Users input: 12 34 56 78 9 10
–> No search result

How can we handle this problem with blank in product names? If there is one or two typo tolerance there is no problem with the standard settings. But with an higher typo - there is a problem.

Thanks.

Marcel

Hello @marcel.thier,

The engine will allow up to two typos in matches.

You can modify the typo tolerance settings by changing the setting in Index->Ranking tab

Then scroll down to your typo tolerance settings

image

One way you could solve your specific problem is that on the client side, before sending the query, you can make sure to remove the spaces when it’s a number.

P.S: For more info about how spaces work in the engine, check the splitting & concatenation section.

Hey @guy.daher ,

the problem is that we need minimum one space to find the product.
There is a real example:

Original Product: 601 8D59345A00TS 1502
Search Input 1: 601 8D59345A00TS1502 -->Search result
Search Input 2: 6018D59345A00TS 1502 -->Search result
Search Input 3: 6018D59345A00TS1502 --> No search result
Search Input 4: 601 10 D1634 5A 00 TS 1502 -->No search result

These are actual problems. With your suggestion we can not solve the problem (see search input 3).

Checking the “splitting & concatenation” did not solve my problem.

Can you offer me another solution?

Thanks.

Marcel

Hello @marcel.thier,

Algolia can handle at most than one concatenation/split per word. So if you have three segments or more, as in your example, it won’t match when you concatenate everything, nor if you split into many little bits.

Please keep in mind that the split/concat feature is primarily aimed at handling typos or alternative spellings. Concatenating everything always would just produce too much noise in most use cases.

In your case, I guess the best solution would be to remove all spaces on the client side before sending the query when you know that you are searching for a product ID. (Maybe a regular expression would do the trick.)

Hello @clement.leprovost,

thank you for your answer. I think your solution to remove all spaces is good. Questions were raised during the implementation. This is the original product name.
image

For this case I have to define a second parameter with name2 which includes no spaces in the product name. How can I add this?

Thanks.

Sorry, I’m not sure to understand your question. :grimacing: Algolia is schema-less, so you can add whatever attributes you see fit in your JSON objects.

Or maybe you are being constrained by a specific Algolia integration? What platform/SDK are you using?

Sorry, my programming skills are very low. When I send the product name without spaces, there is no match. So I want to define a second product name in the JSON file (named name2). Or is this way to handle wrong?

Is there a special attribute which I can add oder is “name2” ok?
I did it this way:

image

I am using no specific Algolia integration.

Yes, it’s fine this way! Just make sure that name2 is inside your searchable attributes. :slight_smile:

Ok that was the mistake.

This case is solved with the cutting down of spaces. Solving these problems creates a new problem. In addition to numbers, our customers also enter letters in the search input. In some cases this has no effect, as the typo tolerance solves the problem. But not for the following example:

Example: My name is
Search input (cutting down the spaces): mynameis

In fact, there is no search result. How can I handle this problem?

Of course, that’s expected. Removing spaces between words will not work in the general case! It was only a workaround to find numeric product IDs. With plain English, it won’t work.

I thought you were only searching for numeric IDs. If you have mixed queries, then I would suggest:

  • Either accept the fact that some queries don’t retrieve any results if they are too different from the actual record. That’s a totally viable option in my opinion. Searching is always a trade-off between being too strict (and risk false negatives) or too lax (and risk false positives).

  • Or normalize only numeric product IDs, e.g. with a regular expression, and leave the rest of the query unchanged. This way you have a finer control over what you are tweaking.