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

重制全局搜索 #4573

Closed
88250 opened this issue Apr 11, 2022 · 14 comments
Closed

重制全局搜索 #4573

88250 opened this issue Apr 11, 2022 · 14 comments
Assignees
Labels
Milestone

Comments

@88250
Copy link
Member

88250 commented Apr 11, 2022

之前在 #3591 中开始尝试 fts5,后来在 #3708 移除了。

现在继续尝试,主要解决中文分词问题。

特别鸣谢链滴社区的一位老铁,他贡献的 C 代码帮助我们实现了 SQLite FTS5 中文单字分词 https://ld246.com/article/1641042386027

@88250 88250 self-assigned this Apr 11, 2022
@88250 88250 changed the title 新增 blocks_fts 虚拟表用于全文检索 新增 blocks_fts 虚拟表用于全文检索 Apr 11, 2022
@88250 88250 added the Feature label Apr 11, 2022
@88250 88250 added this to the 2.0.0 milestone Apr 11, 2022
@88250 88250 changed the title 新增 blocks_fts 虚拟表用于全文检索 重制实现全局搜索 Apr 11, 2022
@88250 88250 changed the title 重制实现全局搜索 重制全局搜索 Apr 12, 2022
@JCJC01
Copy link

JCJC01 commented Apr 12, 2022

搜索后的定位显示也请改进,
举个例子,在思源里建了一个很长的表格,列为产品号,行为其相关信息,但是通过搜索产品号的时候,搜索栏只显示了部分相关信息,具体信息需要准确定位到文本或表格才能查看完整
即在搜索栏的结果内无法通过点击定位到指定的产品号的位置。
谢谢

@88250
Copy link
Member Author

88250 commented Apr 12, 2022

@JCJC01 请关注 #3171

@88250 88250 closed this as completed Apr 12, 2022
@fanglypro
Copy link

ctrp+p的搜索很快,但块引搜索貌似还是有点慢,块引搜索部分现在是还没修改吗?

@fanglypro
Copy link

还有一个问题:搜索时有 "-" 符号时,搜索结果为空,不知道是不是和这个重制有关:

image

可以看到当我在搜索框中写上"-"时,就搜索不到文档了

image

@88250
Copy link
Member Author

88250 commented Apr 13, 2022

@fanglypro 块引搜索没改,我们先在全局搜索上跑一段时间看看。- 是 FTS 的查询语法操作符 https://www.sqlite.org/fts5.html#full_text_query_syntax

@Zuoqiu-Yingyi
Copy link
Contributor

@88250 D大, 2.0.0-beta1 版本中 搜索 dialog 面板块引/块嵌入搜索菜单 中的文件路径匹配的关键词都无法高亮了, 标签搜索用的搜索页文件人类可读路径匹配的关键词可以高亮

Dialog 搜索面板

image

悬浮搜索菜单

image

搜索标签页

image

@88250
Copy link
Member Author

88250 commented Apr 20, 2022

@Zuoqiu-Yingyi 感谢反馈,b2 修复。

@Zuoqiu-Yingyi
Copy link
Contributor

Zuoqiu-Yingyi commented Apr 20, 2022

@fanglypro 块引搜索没改,我们先在全局搜索上跑一段时间看看。- 是 FTS 的查询语法操作符 https://www.sqlite.org/fts5.html#full_text_query_syntax

经过测试, 目前好像不支持使用 FTS 查询指定字段功能查询除 content 以外字段
https://www.sqlite.org/fts5.html#fts5_column_filters, 希望能使用如下语法触发指定字段的查询, 比如想查询某个域名所有超链接, content 字段只能查询到锚文本

-- 查询 markdown 字段
markdown: bilibili
-- 查询 memo 与 markdown 字段
{memo markdown}: bilibili

我想到的一种实现方式: 不指定数据库字段时只查询 content 字段, 指定数据库字段时查询该字段

@88250
Copy link
Member Author

88250 commented Apr 20, 2022

@Zuoqiu-Yingyi 看下帮助文档 - 查询语法,里面有提到一些限制。

@88250
Copy link
Member Author

88250 commented Apr 20, 2022

另外,用自己写的完整 SQL 应该可以做到。

@Zuoqiu-Yingyi
Copy link
Contributor

另外,用自己写的完整 SQL 应该可以做到。

看到了, 多了 12 张表❤

@Zuoqiu-Yingyi
Copy link
Contributor

@88250 又发现了一个bug, v2.0.0-beta-2 全局搜索输入框置空后显示最近编辑文件的功能丢了:broken_heart:

@88250
Copy link
Member Author

88250 commented Apr 20, 2022

@Zuoqiu-Yingyi 收到,感谢反馈啊。

@Zuoqiu-Yingyi
Copy link
Contributor

Zuoqiu-Yingyi commented Apr 21, 2022

@88250 块引用/块嵌入搜索不支持标点符号了, 使用 " 包围也没法搜索到:broken_heart:

思源笔记-bug反馈-26

补充1: 貌似是因为光标后的 " 未被视为查询语句的一部分
``[["#js"` 光标在后引号前无法查询, 在后引号后可以查询
image

image

补充2: [["#" js[["#" AND js 都可以满足要求, 该问题可以忽略了

@88250 88250 added Refactor and removed Feature labels Apr 22, 2022
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

4 participants