London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Using fuzzy search to match user entered queries

agl
agl
Vote:
 

Hello, im trying use the fuzzy search functionality to match results based on a user entered query

My data example is car objects with a title like: "tesla model 3 5yj3 2017 ev 261hk" or "citroën berlingo er ec 2018 1.5 bluehdi 100 102hk".

Given a search query like "tesla 3 2017" id like to return the 5 cars with the titles, that is the most similar to to the query. However im having trouble configuring the fuzzy search in the find client to return any results in this case. If the search query is fairly close to the full title is works fine, however id like to use the results as suggestions to the user in a search bar.

The search query looks like:

public async Task<List<CarObj>> CarSearch(string searchString, int amount)
{
//yeilds no results no matter what i change the minSimilarity to
    var fuzzyResult = await findClient
        .Search<CarObj>()
        .Filter(x => x.Title.MatchFuzzy(searchString,0.8)).GetResultAsync();

    var searchResult = fuzzyResult.Take(amount);

    return searchResult.ToList();
}

Where 0.8 in the minSimilarity. Ive tried adjusting the minSimilarity to both extremes however this yeilded no usable result. Am i missing something?
In the end the plan is to token match the search string before to reduce the search space using fuzzy search, however this requires that i have fuzzy search working :)

#338528
Edited, May 22, 2025 7:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.