Let鈥檚 say I have the following array:
[
{
"title": "Old Man's War",
"color": "red"
},
{
"title": "The Lock Artist",
"color": "red"
},
{
"title": "HTML5",
"color": "blue"
}
]
The user can type a term for fuzzy searching within the title, but also a dropdown to select the exact color.
Should I filter the array by color; create a new Fuse instance with the filtered array; and then do the fuzzy search? Not sure if that鈥檚 the best thing performance-wise if I do that every time a new color is selected from the dropdown.
Having an API to add/remove items as suggested in #379 might be useful.
As per #411, I'm actually working on _logical query expressions_, such that you can search like this:
const result = fuse.search({
$and: [{ author: 'abc' }, { title: 'xyz' }]
})
const result = fuse.search({
$and: [{ author: 'abc' }, { $or: [{ title: 'nonfic' }, { title: 'html' }] }]
})
From there, you can then mix it with extended searching so you could do exact-match for color:
const result = fuse.search({
$and: [
{ title: 'old war' }, // fuzzy "old war"
{ color: "'blue"} // exact match for blue
]
})
Hey hey,
sorry for using this old issue again. I鈥檓 trying to figure out if it鈥檚 possible to mix expressions and search terms in the logical query operators you鈥檝e implemented. Something like this:
const result = fuse.search({
$and: [
'old war', // fuzzy "old war" in all keys
{ color: "'blue"} // exact match for blue
]
})
My goal is to not only search for old war in the title key but in all keys (maybe except color). The code above does not generate any errors, but still does not return any results.
Thanks so much!
Most helpful comment
As per #411, I'm actually working on _logical query expressions_, such that you can search like this:
From there, you can then mix it with extended searching so you could do exact-match for color: