fuzzysort
fuzzysort copied to clipboard
Understanding what are expected results
I was looking for a solution where if I search for 2 or more words, items with those exact 2 words appear before items without those 2 words. Items with either of those 2 works appear next. Only after do items with neither of those 2 works but some combination of their letters appear. That seems, at least to me, what a user would expect.
If my data is
Betty James
Andy Smith
James Smith
Smith James
Dave Miller
Jim Samson
If I search for "James Smith" I'd expect to see this order
James Smith # perfect match
Smith James # same 2 words
Betty James # at least one word
Andy Smith # at least one word (maybe swapped with previous)
Jim Samson # probably #5 because the 2 words start with the same letter and 6 letters same
Dave Miller # 5 letters same
Testing on the demo site here
https://rawgit.com/farzher/fuzzysort/master/test/test.html
If I search for "human" I see several matches
If I search for "web" I see tons of matches (though I think I'd expect matches with "web" as a single word to appear first and they don't)
If I search for "human web" then no answers appear with either word
Am I misunderstanding what this library is supposed to do?
Am I misunderstanding what this library is supposed to do?
yes. https://github.com/farzher/fuzzysort/issues/96#issuecomment-1076422766
i agree with your example but that's just not the use case i guess. not sure if i could make that work without breaking the intended use case of quickly looking up files