EthanRutherford / fast-fuzzy

Fast fuzzy search utility
ISC License
376 stars 8 forks source link

The result of match is too weird #22

Closed jedsada-gh closed 2 years ago

jedsada-gh commented 2 years ago

I have tested matches with "" and "hello" and then I got the result is 1 but my expectation is zero.

const { fuzzy } = require('fast-fuzzy');

(async () => {
  console.log(fuzzy('', 'hello', { normalizeWhitespace: true }));
})();
EthanRutherford commented 2 years ago

This is due to the useSellers option being set to true by default: https://github.com/EthanRutherford/fast-fuzzy#options (it's the default for breaking change reasons, though I will likely release a v2 eventually which will have better defaults).

The Seller's modification to the levenshtein distance finds matching substrings, (for example, if you want "Tim" to match "Timothy", such as in an autocomplete field), so setting useSellers to false will give you the result you expect.

jedsada-gh commented 2 years ago

Thank you for your response. let me try it 🙏🏻

jedsada-gh commented 2 years ago

it's worked useSellers to false.