Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hotoo opened this issue Jul 23, 2019 · 1 comment
Open

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

hotoo opened this issue Jul 23, 2019 · 1 comment

Comments

@hotoo
Copy link

hotoo commented Jul 23, 2019

比如我有 "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);

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

@hotoo
Copy link
Author

hotoo commented Jul 30, 2019

@popomore 看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant