Home > Software design >  EF Core with Jaro-Winkler similarity distance algorithm
EF Core with Jaro-Winkler similarity distance algorithm

Time:10-20

I want to search for strings in my db with some similarity distance algorithm like Jaro-Winkler. However EF Core cannot translate such expressions. So you cannot use an expression like below:

query.Where(x => JaroWinkler.Similarity(x.Title, someText) > 0.5);

My question is how can I implement this with EF Core? Is there any way to do this?

CodePudding user response:

Implement algorithm in your db vendor SQL dialect and register it https://docs.microsoft.com/en-us/ef/core/querying/user-defined-function-mapping

Some db vendors have some comparisons algos or extensions for full-text search (i.e. MS Sql DIFFERENCE or FREETEXT)

Or use in memory processing.

  • Related