174
Views
2
Comments
How to run fuzzy search without querying all records?
Question
Application Type
Reactive

Hi! 
I have small issue. I want to upgrade search functionality a little bit, so it allows small mistakes in wording when searching. For example She's should also display records with word shes and so on. 

I have tried using Fuzzy Wuzzy and Fuzzy String Similarity and Word Stemmer(Reactive)  components, but both require running for loops basically through all my 28k records. Is there a better way to do it? 
I would like to query and display only 50 best matches. 

2022-07-22 08-49-20
Laura Fidalgo

Hey @Matkol ,

You'll always need to query all records to be able to find the 50 best matches, but you can do that kind of search inside a SQL query instead of using forge components.

Here's an example: https://www.dataqualityapps.com/know-how/116-fuzzy-matching-with-sql.html

You can also research other types of string comparisons, like soundex, and use the SQL node to implement.

Cheers

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi  Matkol,

Another way to achieve a fuzzy search is to use the server logic from this Forge component:

https://www.outsystems.com/forge/component-overview/4266/soundex

Basically, when you save your data you need to calculate the soundex value of the attribute on which you want to do a fuzzy search. Save that soundex value also on the same entity in another attribute. Make sure to define an non-unique index on the attribute too.

Now when you want fuzzy search the entity, first use the same soundex function to generate the soundex value then filter on the soundex value.

Regards,

Daniel

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.