Fuse: Won't match entry if query appears after position 70 in the given data set.

Created on 22 Jun 2020  路  2Comments  路  Source: krisk/Fuse

Describe the bug

If the string we want to match appears after position 70, in another string which is longer than 70 chars, it won't match it.

Version

Not sure before this, but happens on 6.0.0 up to 6.2.1.

馃敩Minimal Reproduction

const assert =  require('assert')
const Fuse = require('fuse.js');

const list = [
  {
    title:  'The Lock Artist',
    author: {
      name: 'Steve Hamilton',
      tags: [
        {
          value: 'The readable English, Many desktop publishing packages and web juliancito'
        }
      ]
    }
  }
];


const options = {
  includeScore: true,
  keys:         [ 'author.tags.value' ]
};

const fuse = new Fuse(list, options);

const result = fuse.search('juliancito');
assert(result.length > 0)

question

All 2 comments

Not a bug 馃槃

Please check out the scoring theory.

Since you didn't specify the fuzzy-matching options, Fuse.js will use the following values:

  • location defaults to 0
  • distance defaults to 100
  • threshold defaults to 0.6

With the above options, for something to be considered a match, it would have to be within (threshold) 0.6 x (distance) 100 = 60 characters away from the expected location 0.

Since 70 > 60, it obviously wouldn't match.

Strongly encourage everyone to read the scoring theory for additional insights.

Thank you for the insight.

Will read. Much appreciated.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andy-polhill picture andy-polhill  路  4Comments

abenhamdine picture abenhamdine  路  4Comments

fsskeach picture fsskeach  路  3Comments

ergcode picture ergcode  路  3Comments

washtenawIdtreble picture washtenawIdtreble  路  4Comments