Open asnaeb opened 7 months ago
For anyone landing here with the same problem, I am currently using the following workaround
const fuse = new Fuse(items, {
...yourOptions,
useExtendedSearch: true,
getFn(...args) {
return Fuse.config.getFn(...args) || "\uFFFF";
}
});
This will return the unicode non-character FFFF
as a fallback for nullish values, preventing them to be excluded from the result set. This character is very unlikely to be typed inside a search string so it is working fine for me at the moment but still it would be nice to see this fixed. I was even thinking of making a PR but based on what I've seen it looks like external PR's and issues get very little consideration these times so I'm not really motivated in doing one which could potentially remain ignored. (This doesn't mean to be a critique to the author)
I am facing this issue as well but the suggested workaround does not work in my case. I believe that this is due to searching in a nested property where the parent is undefined. I am using a fork so I could fix it locally, can you @asnaeb give any hints on what causes the issue? Thanks!
This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 30 days
Is there an existing issue for this?
Description of the bug
When using reverse matching operator
!
along with nested search, items with matched fields that have nullish values (undefined
,null
or""
) are completely discarded from the results. I think that a reverse match operator should match nullish values too.""
,null
andundefined
should match!somestring
! Is there a workaround for this that I am missing?The Fuse.js version where this bug is happening.
6.6.2
Is this a regression?
Which version did this behavior use to work in?
None
Steps To Reproduce
We try to match every item whose
lastName
field doesn't include the stringdoe
Result is empty, but none of the three items actually have a
lastName
field which includesdoe
.Expected behavior