I need some help with a fuzzy text search library for a specific use case. I have a large input string and a search text that won't match exactly with it. I'm looking for a solution that can perform fuzzy search and give me the closest match from the input string. For example, if my input string is 'Enter email address here. Type your message in this field.' and my search text is 'Enter your email', I want the output to be 'Enter email'. Any suggestions?
5 Answers
We’ve actually been using minisearch from npm and it’s been working pretty well for us!
I’ve had a great experience with flex-search! It’s pretty effective and you can find it on GitHub.
You could even try building your own solution! Think mechanically about how you'd compare one string to another character by character. For example, you might start by extracting the domain from the search text and matching it against your input. You can weigh the similarity and filter to just show the top 5 suggestions. A tool like Claude could help you with this too if you dump your prompt in there.
I’ve heard good things about flexsearch too, but I find its setup a bit complex. I usually go back to using fuse.js instead since it does fuzzy searching and gives a score for each result - works well for me!
Sounds like a tricky task, almost like a coding interview question! What’s your specific use-case for needing this fuzzy search?
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically