question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing results within edit distance in fuzzy search

See original GitHub issue

Hello, the issue https://github.com/olivernn/lunr.js/issues/375 seems to be still occurring in some cases. Fuzzy search, even with stemming disabled, misses some words within the given edit distance. In particular, it seems to miss terms that are equal to the search term plus a suffix as long as the maximum edit distance.

In other words, searching for abc~2 correctly matches abcx, but misses abcxx. Searching for abc~3 correctly matches abcx and abcxx, but misses abcxxx.

Here is a fiddle reproducing the issue on Lunr v3.2.5 (latest release at the moment of posting): https://jsfiddle.net/3ajf72Ly/1/

I know that https://github.com/olivernn/lunr.js/pull/382 addressed this already, and it did fix some cases, but not all.

This is also visible from the expansion of lunr.TokenSet.fromFuzzyString("abc", 2).toArray(), where abc** is missing:

**abc, **bc, **c, *a*bc, *a*c, *ab, *ab*, *ab*c, *abc, *abc*,
*ac, *acb, *b, *b*, *b*c, *bac, *bc, *bc*, *c, *cb, a*, a**, a**bc,
a**c, a*b, a*b*, a*b*c, a*bc, a*bc*, a*c, a*c*, a*cb, ab, ab*,
ab**, ab**c, ab*c, ab*c*, abc, abc*, ac, ac*, ac*b, acb, acb*, b,
b*, b*ac, b*c, ba, ba*, ba*c, bac, bac*, bc, bc*, bca

Thanks again for the great library!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
olivernncommented, Feb 26, 2019

I’ve just pushed a fix for this in 2.3.6. Thanks again for taking the time to investigate and report the bug!

1reaction
olivernncommented, Feb 11, 2019

That’s annoying! Thanks for reporting, I’ll put together some tests and then figure out how to get a fix out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Elasticsearch inconsistency in the fuzziness parameter with ...
Generates an edit distance based on the length of the term. ... But as you can see below, the results are coming accurately....
Read more >
Fuzzy search doesn't return all available results - Elasticsearch
I've set the max_expansions to be 10,000 but still no progress. I've tried both match query + fuzziness option and fuzzy query.
Read more >
Fuzzy Queries in Elasticsearch | DSL [ES7 for Beginners #4.8]
... the fuzzy query creates a set of all possible variations, or expansions, of the search term within a specified edit distance.
Read more >
There's more to fuzzy search than correcting typos | Algolia Blog
Without typo tolerance, the search engine would return no results. ... on distance, following the Damerau–Levenshtein distance algorithm.
Read more >
What is a Fuzzy Search? - TechTarget
Learn how fuzzy search uses a fuzzy matching algorithm to return results based on ... The fuzzy search returns matches within a certain...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found