Search Algorithms

SearchMatch 是将 textpattern 匹配的接口。匹配结果保存在返回的值 SearchMatchResult 中。匹配结果包含有关匹配位置和匹配的总体得分的信息。 fzf.

Implementations

FuzzyMatchV2Search

fzf FuzzyMatchV2Search 算法的移植。执行快速模糊搜索并且擅于快速查找路径。

ExactMatchNaive

fzf ExactMatchNaive 算法的移植。如果你知道要搜索的内容,则简单的精确匹配工作得更准确。

SearchMatch

算法和默认语法隐藏在受包保护的类内,因为在我们知道 API 能够长期支持之前,我们不想完全开放这些类。你需要通过其内部构建器构建 SearchMatch

link:../../../../../src/test/java/org/springframework/shell/docs/SearchAlgorithmsSnippets.java[role=include]

可以对 case sensitivity 进行配置,具体取决于 direction 搜索发生的位置或文本在搜索发生之前是否应 normilized。当不同的语言对相同类型的字符有细微差别时,归一化非常方便。

搜索算法根据下表所示的搜索语法选择。

Table 1. Search syntax
Token Match type Description

hell

fuzzy-match

Items that match hello

’stuff`

exact-match

Items that include stuff

Examples

link:../../../../../src/test/java/org/springframework/shell/docs/SearchAlgorithmsSnippets.java[role=include]