how can i match multiple words in fuse while ignoring anything in between and also ignoring the word-order?
for the following example (pseudo-code) the algorithm should match the all items in the possibleResults
-array for the search-term team lead
.
const options = {}
const possibleResults = ['lead', 'team lead', 'lead of software development team']
const fuse = new Fuse(possibleResults, options)
fuse.search('team lead')
i've tried it with the following options:
{
threshold: 0, // the lower the more exact
ignoreLocation: true, // ignores how "far" result is
findAllMatches: true,
};
but without success. as far as i know Fuse now always sets tokenize: true
per default. so that's not helping ...
one solution i'll leave here just in case someone else stumbles across the same issue is:
const options = {useExtendedSearch: true}
const adaptedSearchTerm = 'team lead'.split(' ').reduce((previousValue, currentValue) => previousValue + ` '${currentValue}`, '');
fuse.search(adaptedSearchTerm)
which makes use of the extended-search feature of fuse by adding '
in front of every splitted search-term.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With