krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
18.1k stars 766 forks source link

Search matching improvement, split search string by space #302

Closed alexgrozav closed 4 years ago

alexgrozav commented 5 years ago

Hey! First of all, amazing work on Fuse.js. I've moved my search functions from Algolia to a completely front end solution using Fuse.

Comparing Fuse and Algolia, I've encountered a few differences which I believe could be easily improved.

Let's take the following data set:

[
  { title: 'Alert', subtitle: 'Variants' },
  { title: 'Button', subtitle: 'Sizes' }
];

Searching using the following search string: Alert Variants or Button Sizes will yield an empty results array.

Algolia would split the search string and identify the two keywords in the two different search keys, title and subtitle.

I know the current behaviour might be intended, but it would be nice to add an option to split the search string by the space separator and use both words individually.

KWierso commented 5 years ago

I'm hitting a similar issue. I have a data set like this:

[
  {name: 'Android web platform test', symbol: 'wpt'},
  {name: 'Linux web platform test', symbol: 'wpt'},
  {name: 'Android some other test', symbol: 'se'}
]

For the search options, I have keys: ['name', 'symbol'], tokenize: true, matchAllTokens: true

I'd like to be able to have the first item in the dataset returned if I search for android wpt, but it returns an empty array.

rastalamm commented 4 years ago

Possible duplicate of issue #235

github-actions[bot] commented 4 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days