redis / redis-om-node

Object mapping, and more, for Redis and Node.js. Written in TypeScript.
MIT License
1.18k stars 80 forks source link

feat: add support for fuzzy matching in full-text search #200

Closed Neeraj-Ghodla closed 1 year ago

Neeraj-Ghodla commented 1 year ago

This PR address this Github issue by adding support for fuzzy matching in Full-Text search.

To add fuzzy matching support, the function definition for match and matches methods have been modified

from

match(value: string | number | boolean): Search
matches(value: string | number | boolean): Search

to

match(value: string | number | boolean, options?: { fuzzyMatching?: boolean; levenshteinDistance?: 1 | 2 | 3 }): Search
matches(value: string | number | boolean, options?: { fuzzyMatching?: boolean; levenshteinDistance?: 1 | 2 | 3 }): Search

The fuzzyMatching parameter is used to enable fuzzy matching and the levenshteinDistance parameter is used to define the Levenshtein distance for fuzzy matching.

For more info about fuzzy matching with Redis please checkout the Redis docs

guyroyse commented 1 year ago

Probably gonna do a publish with a couple of community PRs in the next week or so. This will be amongst them. Thanks!

guyroyse commented 1 year ago

Merged and published. https://www.npmjs.com/package/redis-om