Skip to content

find 为什么要优先匹配 endsWith('/{keyword}') ? #48

@hotoo

Description

@hotoo

比如我有 "abc" 和 "tiny-abc" 两个仓库,"abc" 是常用的关键字,但是 projj find abc 始终只能搜到 "abc"。

    const keys = Object.keys(yield this.cache.get());
    let matched = keys.filter(key => key.endsWith(repo.replace(/^\/?/, '/')));
    if (!matched.length) matched = keys.filter(key => key.indexOf(repo) >= 0);

我觉得搜索结果应该将所有命中的都返回,只是排序上可以有侧重。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions