jeancroy / FuzzySearch

:mag: Fast autocomplete suggestion engine using approximate string matching
MIT License
194 stars 32 forks source link

Node.js support? #2

Open djMax opened 8 years ago

djMax commented 8 years ago

I notice there's at least one place the library uses window.performance, which fails in node. It's also not published to npm... But it sure looks like a very nice module for autocompletion amongst other things. Any reason it doesn't support node and/or isn't published?

jeancroy commented 8 years ago

I notice there's at least one place the library uses window.performance, which fails in node.

There would not be much complication to replace that call to performance, or choose depending of node.js VS browser.

Any reason it doesn't support node and/or isn't published?

None, I extracted this from another web based project then continued development, could add npm package.

for autocompletion amongst other things

Have you checked out fuzzaldrin-plus ? It's published to npm and is used for auto-completion in the atom text editor.

This one module is more geared for finding stuff across multiple fields / complex object, and with natural language query. The other do sublime text like fuzzy searching.

ammojamo commented 7 years ago

@jeancroy First of all - congratulations on a fantastic library, I'm surprised it hasn't received more attention! I took a look at your bit vector LCS implementation and read some of the referenced papers and I'm really impressed.

I thought I would try and pick up this issue.

  1. Use of window.performance: it looks like this has already been addressed in the code (https://github.com/jeancroy/FuzzySearch/blob/d76d2ef4b3037e22ae1a7317147c73a03cc66f26/src/search.js#L15)
  2. Publishing to npm: I don't have any experience with this but it looks like package.json is already good to go? The only thing I picked up is that perhaps the grunt packages should be moved from dependencies to devDependencies. Also the name FuzzySearch is already quite overused in npm (https://www.npmjs.com/search?q=FuzzySearch) - not sure how you feel about a different name?
jeancroy commented 7 years ago

Yeah this library need some love. For example one demo is broken I beleive. I'll try to find the time to fix and publish this weekend. You are right that, as a name, "FuzzySearch" is almost non descriptive, this library is a bit lost in a sea of basic levenshtein distance based libraries.

As for window.performance it can be completely removed. It's only used to try to compute an adaptative debounce time, because choosing a constant that work on every machine is hard. We don't really need the extra resolution of that counter.

For the name, do you have anything to suggest ?

ammojamo commented 7 years ago

FastComplete, FastSuggest, CleverMatch, LightingSearch

Or something a bit more abstract:

Frenetic (I dunno - just sounds good) Completic (Portmanteau with Complete)

This is hard!

aguynamedben commented 7 years ago

+1, I'll send beer money. This library looks awesome. I'm digging into the performance right now. I started to use buzzaldrin-plus (thanks for that, too!), but my data is document titles, not file paths, and I want to support out-of-order queries, so this looks more promising if I can get it working.

Once I get the basics working I'll check back in, I might be down to help out if it can handle 1mm documents as well as fuzzaldrin-plus does with maxInners tuned properly.