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

搜索支持表达式 #797

Closed
88250 opened this issue Dec 20, 2020 · 0 comments
Closed

搜索支持表达式 #797

88250 opened this issue Dec 20, 2020 · 0 comments
Assignees
Labels
Milestone

Comments

@88250
Copy link
Member

88250 commented Dec 20, 2020

逻辑连接

支持操作符 ANDORNOT(注意需要大写),比如 foo AND bar OR baz 表示同时包含 foo 和 bar 或者包含 baz;foo NOT bar 表示包含 foo 但不包含 bar。

  • AND 可以省略,比如 foo AND bar 可以简写为 foo bar
  • OR 可以使用 || 代替,AND 可以使用 && 代替,比如 foo && bar || baz
  • NOT 可以简化为前缀 ! 或者 -,比如 foo NOT bar 可以简写为 foo !bar 或者 foo -bar

精确匹配

支持通过 "foo" 指定精确匹配,比如 foo !"bar baz" 表示包含 foo 并且不包含 bar baz。

模糊匹配

  • 支持通过 ? 指定单个字符,比如 f?o 能够模糊匹配到 fo、fao、fbo
  • 支持通过 * 指定多个字符,比如 f*o 能够模糊匹配到 fo、fao、fabco

正则匹配

支持通过 /foo/ 指定正则表达式,比如 /f[a-z]{2}/ 能够匹配到 f 开头跟两个 a-z 字母。

分组

支持通过 (foo) 指定优先级,比如 foo AND (bar OR baz) 表示同时包含 foo bar 或者是同时包含 foo baz。

指定字段

  • path:支持通过 path:foo 来指定文档路径,比如 path:!foo 表示在不包含路径为 foo 的文档中搜索;path:(foo OR bar) 表示在路径为 foo 或者 bar 的文档中搜索
  • type:支持通过 type:foo 来指定内容块类型,可用的类型请参考((20201222095049-hghafhe "类型过滤"))。比如 type:h 表示在标题中搜索;type:(m OR c) 表示在数学公式块或者代码块中搜索

指定时间范围

支持通过 time: [20200219 TO 20200825] 来指定内容块创建时间,比如 time: [20200219163030 TO 20200825] 表示在 2020 年 02 月 19 日下午 16 时 30 分 30 秒到 2020 年 08 月 25 日 00 时 00 分 00 秒创建的内容块中搜索。

  • [ 表示大于等于,{ 表示大于;] 表示小于等于,} 表示小于
  • 可以混合使用 [{,比如 time: [20200219 TO 20200825}
@88250 88250 self-assigned this Dec 20, 2020
@88250 88250 changed the title 全局搜索空格分隔关键字调整为 AND 逻辑 搜索支持过滤 Dec 20, 2020
@88250 88250 changed the title 搜索支持过滤 搜索支持表达式 Dec 21, 2020
@88250 88250 added this to the 0.5.43 milestone Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-en_US that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-en_US that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-en_US that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-zh_CN that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-zh_CN that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-zh_CN that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-en_US that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-en_US that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-zh_CN that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-en_US that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-zh_CN that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-en_US that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-en_US that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-zh_CN that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-zh_CN that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-en_US that referenced this issue Dec 22, 2020
88250 added a commit to siyuan-note/user-guide-zh_CN that referenced this issue Dec 22, 2020
@88250 88250 closed this as completed Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants