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

请求为 searchEntryConfig 提供预处理 key 的功能 #1815

Closed
davidxuang opened this issue Apr 17, 2024 · 1 comment
Closed

请求为 searchEntryConfig 提供预处理 key 的功能 #1815

davidxuang opened this issue Apr 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@davidxuang
Copy link
Contributor

davidxuang commented Apr 17, 2024

您的功能请求是否与问题有关? 请描述一下。

有的站点的搜索功能默认将搜索词语视为而非的关系集合,需要使用扩展语法(通常是包含 +keyword 和排除 -keyword)才能实现与其他站点匹配的搜索行为。如果不经过特殊处理,多关键词搜索将会匹配大量无关种子。

描述你想要的解决方案

参照skipNonLatinCharacters,实现硬编码的解决方案,专门实现 key = key.replace(/\s+/g, " +")。或可定名为 useIncludeOperator(术语 operator 参照 Google 的用法)。

{
  "searchEntryConfig": {
    "useIncludeOperator": true
  }
}

描述您考虑过的替代方案

实现可扩展的方案,为 searchEntryConfig 提供正则替换 regex 的键(暂称 keyReplace),同样使用 String.prototype.replace()

{
  "searchEntryConfig": {
    "keyReplace": {
      "\\s+": " +" // 从第二个词开始使用包含语法
    }
  }
}

其他附加信息

我可以自己实现这个功能,不过还是要首先讨论方案。

@davidxuang davidxuang added the enhancement New feature or request label Apr 17, 2024
@davidxuang
Copy link
Contributor Author

样例

没有特殊处理的搜索词,含有大量无关结果:
图片
使用 include operator:
图片

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

No branches or pull requests

2 participants