krisk / Fuse

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

Unintuitive search results #725

Closed ChoppinBlockParty closed 7 months ago

ChoppinBlockParty commented 1 year ago

For the code

const fzf = new Fuse<string>(
    [
        'top book options',
        'ice european options'
    ],
    {
        shouldSort: true,
        includeMatches: true,
        includeScore: true,
        ignoreLocation: true
    }
)

fzf.search('ice options')

the results would be

[
  {
    item: 'top book options',
    refIndex: 0,
    matches: [
      {
        indices: [ [ 0, 3 ], [ 5, 6 ], [ 8, 15 ] ],
        value: 'top book options'
      }
    ],
    score: 0.47251476595266545
  },
  {
    item: 'ice european options',
    refIndex: 1,
    matches: [
      {
        indices: [ [ 0, 4 ], [ 7, 9 ], [ 11, 19 ] ],
        value: 'ice european options'
      }
    ],
    score: 0.47251476595266545
  }
]

It is surprising because i would expect the second item to be first in the return list. Any chances to improve the results.

github-actions[bot] commented 8 months ago

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