Fuzzy Match on EPiServer.Find

Tarik Kilic
Beerwulf
Published in
2 min readNov 16, 2018

--

As Beerwulf, we use EPiServer.Find as search framework. It is a cloud SaaS search engine based on ElasticSearch that you can easily integrate your existing EPiServer CMS and Commerce solutions. I’ll leave further details about Find to a future post, maybe a developer’s guide. Now I want to talk about a fuzzy match, a pretty basic search feature and how to do it in Find framework. We never want a user to end up with an empty results page. That’s not good. If you’re searching for beers, you should get best relevant results, even if you make a typo. That idea pushed us to implement fuzzy match on our search a while ago.

First we need to create an extension method to ITypeSearch which is also asserting Fluent API standarts. Responsibility of this method is basically combining existing search query (ITypeSearch) with new fuzzy querying (FuzzyQuery) we’re going to create. The way to do it is using BoolQuery class in extension method to combine new query object we created with existing query in request body. You can find example in code snippet below

A few remarks in here about search extension we created; MinSimilarity property in FuzzyQuery class is basically how fuzzy the match should be. Items that contain words have similarity less than that threshold will be left out. Consuming this extension method is pretty easy to plug-in your existing querying service.

In results, obviously, exact matches are more relevant and therefore have a higher score (more likely to be seen in a higher position in your results page). But if your term has no exact matches, it’s nicer to see results of some similar terms.

--

--

Tarik Kilic
Beerwulf

building teams, products and systems that scale. currently @SurveyMonkey, previously @Beerwulf.com