fuzzysort icon indicating copy to clipboard operation
fuzzysort copied to clipboard

Search query to match multiple properties?

Open clieee opened this issue 2 years ago • 4 comments

Hi,

Thanks for a great library. I have an array with some objects, they are like:

var myArr = [{title: "Audi Q3", position: "Stockholm"}, {title: "Volkswagen e-tron", position: "Berlin"}]

and then a query like this: var myQuery = "audi stockholm" but then I get no matching results at all? If the query only contains "audi" or "stockholm" then I get the hits, but not when combined...?

clieee avatar May 26 '22 10:05 clieee

oops. i recently added the ability to search with spaces. and i don't use keys, so i forgot to make sure they work well together.

the keys are each searched separately, neither match your search so you get no results.

i'm not sure how this should work. but the workaround is split your search into multiple searches and combine the results, or simply merge your keys into 1 combined string and don't use the keys feature.

farzher avatar May 27 '22 01:05 farzher

Okay, got it, thank's for letting me know!

clieee avatar May 30 '22 12:05 clieee

[...] or simply merge your keys into 1 combined string and don't use the keys feature.

Hi I did this by merging my users collection Ex : {firstname: 'Martial', lastname: 'SERON', username:'mseron'} => 'Martial|SERON|mseron'

When I type 'marser' it finds the user, but there is no result with 'sermar'. How can I make it work ?

MartialSeron avatar Aug 24 '22 08:08 MartialSeron

sermar shouldn't match. ser mar should match. this issue is about searches that contain spaces.

farzher avatar Aug 24 '22 09:08 farzher