从Fuse.js搜索查询中发现随机结果

时间:2019-08-07 14:09:24

标签: typescript fuzzy-search fuse.js

我正在尝试使用超过1000个商家的字典进行基本查询。对于我的许多查询,我得到的结果似乎都是错误的。

查询:BIKKURIJAPANESE RESTAURATORONTO ON

我的选择:

var options = {
  shouldSort: true,
  includeScore: true,
  includeMatches: true,
  threshold: 0.03,
  location: 0,
  distance: 10,
  maxPatternLength: 100,
  minMatchCharLength: 8,
  keys: [
    "merchant_name"
  ]
};

我的示例词典:

[
    {
    "merchant_name": "FINN AIR",
    "category_code": 5260,
    "master_code": "Business_Expense"
  },
  {
    "merchant_name": "AER LINGUS",
    "category_code": 5260,
    "master_code": "Business_Expense"


  },
  {
    "merchant_name": "AIR LANKA",
    "category_code": 5260,
    "master_code": "Business_Expense"
  }
 ]

我的结果:

[
  {
    "item": {
      "merchant_name": "FINN AIR",
      "category_code": 5260,
      "master_code": "Business_Expense"
    },
    "matches": [],
    "score": 0.029411764705882353
  },
  {
    "item": {
      "merchant_name": "AIR LANKA",
      "category_code": 5260,
      "master_code": "Business_Expense"
    },
    "matches": [],
    "score": 0.029411764705882353
  }
]

为什么我的查询与FINN AIR相匹配,如果它们看起来根本不相似? 0.03的高阈值怎么可能呢?最后,最小字符长度,位置和阈值是否被阈值覆盖?如果不是,他们在这种情况下扮演什么角色?

感谢您的帮助!

0 个答案:

没有答案