Struggling with Fuzzy Search

I don't know what I'm doing wrong (or more likely, what I'm missing) when it comes to fuzzy search.

I've got a database full of monitors that users can search. The first issue I was having made me discover that partial match wasn't a default thing. To fix that, my function stack takes the user's query, breaks it into an array, adds a :* to the end of each word, and then re-assembles the query.

So 144 gaming monitor, which would normally return zero results (because my listings are formatted as '144hz'), would be transformed to 144:* gaming:* monitor:* . Yay!

The next (and even more common) problem I'm seeing with user search activity is if the user adds a word that isn't part of the products meta data.

For example, let's say I have a 'Samsung Odyssey G51C Monitor' and the user searches 'samsung odyssey G51C gaming monitor'. Because the user included that extra word 'gaming' which isn't part of the product metadata, nothing is returned.

I know there are great services like Algolia & Elasticsearch that can accomplish this and a lot more, but I feel like what I'm wanting to accomplish here is a very simple version of search and I don't currently need the bells and whistles of the other platforms.

It seems like if at least ONE word in their query matches any of my products they should be getting some results. What should I be doing to make this happen?

2 replies