Skip to content

SQL 搜索支持多个搜索关键字匹配文档 #7350

Closed

Activity

self-assigned this
on Feb 13, 2023
added this to the 2.7.5 milestone on Feb 13, 2023
changed the title [-]多个搜索关键字匹配文档[/-] [+]SQL 搜索支持多个搜索关键字匹配文档[/+] on Feb 13, 2023
88250

88250 commented on Feb 13, 2023

@88250
MemberAuthor

仅支持用 SQL 搜索方式:

select a.*
from blocks as a,
     (select *
      from blocks
      where id in
            (select root_id from blocks where content like '%思源%')
        and id in
            (select root_id from blocks where content like '%本地%')) as b
where a.root_id = b.id
  and (a.content like '%思源%' or a.content like '%本地%')

以下截图是按文档分组的结果:

image

mozhux

mozhux commented on Feb 13, 2023

@mozhux

有点复杂啊。。那这样对应的高亮有吗

88250

88250 commented on Feb 13, 2023

@88250
MemberAuthor

SQL 搜索没有高亮,如果一定要的话可以看下源码,参考源码用 fts 可以实现。

mozhux

mozhux commented on Feb 13, 2023

@mozhux

那似乎现在的版本就支持多条件搜索匹配呀。。新版是支持了什么新东西吗?,支持显示到块级别?

select * from blocks where (id in(select root_id from blocks where content like '%思源%')) and  (id in (select root_id from blocks where content like '%本地%')) 

image

88250

88250 commented on Feb 13, 2023

@88250
MemberAuthor

是的,支持显示到具体命中的块。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @88250@mozhux

      Issue actions

        SQL 搜索支持多个搜索关键字匹配文档 · Issue #7350 · siyuan-note/siyuan