list.fuzzysearch.js icon indicating copy to clipboard operation
list.fuzzysearch.js copied to clipboard

Searching for any regex special characters fails

Open daformat opened this issue 10 years ago • 0 comments

In List.js, this very specific line is used to prepare a string so that any regex special character (such as: -[]{}()*+?.,^$|#) is escaped: https://github.com/javve/list.js/blob/master/src/search.js#L33

But in the diff match and patch algorithm from google that was used for the fuzzy search plugin, we don't need to escape any of those. In fact, escaping those breaks the algorithm, an easy test is to search for something like '..' while making sure the data contains something that should match.

More specifically, my use case was I had two entries : one was "L. 121-1" and the other was "L. 122-10".

Results were erratic as long as my query included the dot, no problem when it wasn't. So fuzzy searching for "L 12" successfully got me 2 results, but searching for "L. 12" didn't.

My thought would be to override the setSearchStringin the Fuzzy Search code but anything that prevents such commons characters to be escaped would do the trick :)

daformat avatar Sep 09 '14 19:09 daformat