react-native-search-filter icon indicating copy to clipboard operation
react-native-search-filter copied to clipboard

Allow keys weight.

Open SkyzohKey opened this issue 7 years ago • 3 comments

Fuse does supports specifying the keys as an array of objects like the following, would be super nice to have. It permits to sort the results depending on the weight the field that matched has. 😋

const KEYS_TO_FILTER = [
  { name: 'item.title', weight: 1.0 },
  { name: 'item.description', weight: 0.8 },
  { name: 'item.author', weight: 0.4 }
];

SkyzohKey avatar Jan 03 '18 18:01 SkyzohKey

Will surely add this one on the next release. Thanks for the suggestion!

mjsolidarios avatar Jan 04 '18 12:01 mjsolidarios

Just want to +1 this and also mention that it would be really nice to be able to set other Fuse options such as threshold. The default of 0.6 is too permissive for our use case.

jeremyk avatar Apr 03 '18 20:04 jeremyk

Yes, +1. Thanks for considering this!

wfried avatar Apr 26 '18 18:04 wfried