Closed tommedema closed 4 years ago
Looks like you’re looking for value-based boosting at query time. Since this isn’t supported out-of-the box (and I don’t have plans to include it), you could work around the issue by:
score = score * ((1 - weight) || 1)
(Note: make sure you set includeMatches
to true
, that way if you have multiple matched entries per item, you’ll know exactly which key/value was matched)
We're looking to use Fuse to implement an email autocomplete component. A typical input might look like this:
Here
frequent@host.tld
has a higher weight because this email address is used more frequently thanfrequent@not.tld
. If the user now searched for "frequent", the entry with the higher weight should appear above the entry with the lower weight.Since the keys are the same, this is a weighted search on a value basis, rather than on a key basis. How would we achieve this with Fuse?