Closed divmgl closed 1 year ago
Switching prefix to true
seems to make it work as intended.
Hi @divmgl , Thanks for reporting this, but I cannot reproduce it. In fact, if I try a simple demo, things work properly:
const ms = new MiniSearch({ fields: ['txt'] })
const docs = [{ id: 1, txt: 'f' }, { id: 2, txt: 'fo' }, { id: 3, txt: 'foo' }, { id: 4, txt: 'fox' }]
ms.addAll(docs)
ms.search('fo', { fuzzy: 2 })
/* =>
[
{
id: 2,
score: 1.8059592064889043,
terms: [ 'fo' ],
match: { fo: [Array] }
},
{
id: 3,
score: 0.6095112321900052,
terms: [ 'foo' ],
match: { foo: [Array] }
},
{
id: 4,
score: 0.6095112321900052,
terms: [ 'fox' ],
match: { fox: [Array] }
},
{
id: 1,
score: 0.4063408214600035,
terms: [ 'f' ],
match: { f: [Array] }
}
]
*/
Could you please provide some example code?
Closing this because I cannot reproduce it, and I suspect it is an application issue, but I am happy to reopen it if some reproduction is provided @divmgl
~Yeah, disregard. It's user error. Thanks.~
~Actually, it seems to happen with bigger datasets. But alas, I can't copy the entire data set onto the public repro. No worries.~
Nope, I'm definitely wrong and it was user error. Thanks.
Thanks @divmgl for replying :)
Not much to say here. In two distinct datasets, searching with two characters using fuzzy searching >= 1 will always return an empty array.