Removing - from searches

Hello @rayrutjes,

My client sells ink and toner for printers. An example of what happens is a client enter tn350 where the term is tn 350 or tn-350. It’s all about the -. When used in the search, it considers the term as one word instead of finding also tn 350 for example. Is there any way of going around that in the settings?

Best regards,

Paul

1 Like

Hi Paul,

I’d love to try and help here. I was wondering if, to best identify what may be going on, I could ask a clarifying question to get some more context. I was wondering if you could provide an example of what results are returned when you perform each search (tn350 vs tn-350)? Typically this use case should work as you are expecting out-of-the-box (both tn350 tn-350 should return the correct result), so any additional info about what you’re seeing might be useful for troubleshooting and would be greatly appreciated.

Best,
Sepehr

2 Likes

Hello Sepehr,

So I am attaching 3 screenshots. The first one searching for tn 225, the second for tn-225, and the third for tn225.

tn 225 shows all the results. tn 225 found in the title.
tn-225 shows all the results. tn-225 found in the title.
tn225 only shows 4 results. tn-225 found in the title, but the SKU of these products includes tn225.

Hope it helps. Also if you need to check out the site, we do have a staging environment you can use.

Best regards,

Paul

Hi Paul,

Thanks for the info, this certainly helps give context on the issue. I took a look at your site and tried running the two queries, “tn225” and “tn-225” (which Algolia’s engine effectively treats the same as “tn 225”). I think I have an idea of what may be going on here. A couple of thoughts:

  1. The query “tn225” is matching 4 results on an attribute other than the post “name/title” (likely inside the “taxonomies” attribute since you’re using Wordpress, or “SKU” attribute as you suggested). As this does not appear to be the desired behavior, I might suggest checking to see if you have “SKU” or “Taxonomies” set as searchable attributes in your dashboard (under Indices > Rankings tab)…if so I would consider whether or not you want to have those be searchable (i.e. do you think your users intend to be actively searching for SKU or taxonomy values?).

  2. While TN225Y (no space, and including the ‘Y’) would indeed match the correct record, the query “tn225” failing to match the attribute value “TN-225Y”, “TN-225C”, or “TN-225M” is a bit of an edge case. In order to successfully match the desired records with this query, the engine must try to find results by splitting the string “tn225” at every position to see if there is a record with an attribute that contains two or more words that match the various sub-words in this query (such as “tn 225”). The engine can do this, however, it cannot simultaneously use the prefix matching feature to identify the correct records which have the suffix “Y”, “C”, and “M” in their name/title attributes.

In order to return more relevant results when your users commit such a specific set of typos, would it be possible to do a bit of pre-processing to your data set before you index it, such as adding an additional attribute to each record that might contain model numbers without any dashes or spaces, to cover the use case of people searching for such?

Best,
Sepehr

2 Likes

I deactivated Algolia and added Search Everything, and ended up getting 3 additional products, that have tn225 in the SKU (but not the title). Now, Search Everything ends up giving results in about 10 seconds, which is obviously unacceptable, but I’m wondering how come their plugin can find these and Algolia cannot?

Best regards,

Paul

Hi Paul,

I’m going to loop in a colleague to help determine what the best solution for your use-case might be.

I believe the best path forward may be to enrich your data slightly, perhaps with an additional attribute to contain formatted model-numbers as I mentioned above, or perhaps by leveraging synonyms (provided this is only an issue for a small/manageable subset of your records).

In the meantime, would it be possible to know which 3 additional products were in your search results using the alternative plugin? This might provide useful context.

Best,
Sepehr

I can set you up on the staging environment to run some tests. But these products that showed up have the text in the SKU.

In the meantime, my client will populate his data with the different variations of the writings…

Best regards,

Paul

1 Like

Yes, I do think that this seems like a very reasonable way of moving forward based on my understanding of the issue. I also think that, as long as this issue is restricted to a small set of queries like the ‘tn225’ vs ‘tn-225Y’ case you mentioned, that employing the synonyms feature could be a good way to go as well.

1 Like

Can we import a list of synonyms?

Yes you can!

1 Like

Nice! Looks very easy!

Search is working great now! We just populated the attributes and we’re good to go.

Thank you and Best regards,

Paul

1 Like

That is awesome to hear!

Glad that everything is working the way you wanted now. :smiley:

Thanks @sepehr.fakour for your guidance here!

I wanted to to warn you @paul1 that you will loose your synonyms after each re-index operation done from the admin.

This will be fixed in the next release v2.0.0.

1 Like