【发布时间】:2016-05-06 14:16:33
【问题描述】:
每当我在 Sublime Text 中使用 Goto Anything 搜索并开始键入搜索当前项目中的文件时,我都会根据 Sublime Text 的模糊搜索算法得到一大堆结果,每个结果都带有一个数字。
我认为这是搜索“强度”的某种分数,但我只是想确认一下。这个数字的依据是什么?
【问题讨论】:
标签: sublimetext fuzzy-search string-search
每当我在 Sublime Text 中使用 Goto Anything 搜索并开始键入搜索当前项目中的文件时,我都会根据 Sublime Text 的模糊搜索算法得到一大堆结果,每个结果都带有一个数字。
我认为这是搜索“强度”的某种分数,但我只是想确认一下。这个数字的依据是什么?
【问题讨论】:
标签: sublimetext fuzzy-search string-search
如您所料,这些数字似乎确实代表了比赛强度。
我在测试您的假设时注意到了一个奇怪的效果,然后继续创建虚拟文件 CustomCompletions.CustomCompletions 和 CustomCompletions(一个没有扩展名的文件)以进行进一步比较。
结果如下:
如你所见,
CustomCompletions 与1524 的排名最高
CustomCompletions.py & CustomCompletions.todo 共享排名1507
CustomCompletions.CustomCompletions & CustomCompletions.sublime-settings 共享排名1490
我发现奇怪的是,第 2 组和第 3 组的排名不同,尽管共享一个与查询完全匹配的基本文件名。
我认为这可能是由于文件扩展名中的字符数造成的,因此我通过创建以下文件来测试该假设:
CustomCompletions.a
CustomCompletions.ab
CustomCompletions.abc
CustomCompletions.abcd
CustomCompletions.abcde
CustomCompletions.abcdef
CustomCompletions.abcdefg
CustomCompletions.abcdefgh
CustomCompletions.abcdefghi
CustomCompletions.abcdefghij
CustomCompletions.1
CustomCompletions.12
CustomCompletions.123
CustomCompletions.1234
CustomCompletions.12345
CustomCompletions.123456
CustomCompletions.1234567
CustomCompletions.12345678
CustomCompletions.123456789
CustomCompletions.1234567890
但事实证明,他们的排名都在1507,与第二组的排名相同。
由于该结果,我仍然不确定哪些标准会影响共享基本名称的文件的排名,该基本名称与 Goto Anything 查询完全匹配,但具有不同的文件扩展名。
【讨论】: