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

Support ignore index #9198

Closed
frostime opened this issue Sep 16, 2023 · 14 comments
Closed

Support ignore index #9198

frostime opened this issue Sep 16, 2023 · 14 comments
Assignees
Milestone

Comments

@frostime
Copy link
Contributor

frostime commented Sep 16, 2023

为 SearchRefBlock 功能添加黑名单

In what scenarios do you need this feature?

当我们键入 [[ 并输入锚文本的时候,就会给出一个长长的列表,允许用户在里面选择一个 Ref Block。

image

但是有时有会有这种需求:某些文档我们已经很确信不打算把它作为一个引用的目标。所以希望允许用户设置让某些文档,或者某些路径下的文档不在 Search Ref Block 菜单当中显示。

Describe the optimal solution

这个过滤功能甚至可以直接在前端完成,直接对 searchRefBlock API 的结果 Array 做一个 filter。

例如如果是不显示特定 Block,就根据 id 过滤掉对应的 block,如果是不显示特定文档树下的内容,就根据 path 过滤。

image

Describe the candidate solution

No response

Other information

No response

@88250
Copy link
Member

88250 commented Sep 17, 2023

目前考虑有两个方案:

  1. 使用块自定义属性 custom-sy-search-exclude-ref=true 来过滤
  2. 添加配置文件 data/.siyuan/search.json,支持配置 pathPrefix 和 id

估计方案 2 更好一些(支持路径前缀),配置步骤也简单一些。两个方案都不考虑做界面了,考虑通过插件实现配置界面。

@88250
Copy link
Member

88250 commented Sep 17, 2023

另外,之前也有收到不编入全局搜索索引的需求,比如某个路径(包含子文档)不想编入搜索索引,和这个需求有点类似,只不过一个是直接不编入索引,一个是搜索结果过滤。

如果用方案 2 的话可以在 search.json 中增加 noindex 配置项来忽略索引。

@frostime
Copy link
Contributor Author

两个都可以。前者是块粒度的,后者是文档树粒度的。
不过总体来讲,后者确实更好一点,大部分情况下需要忽略也就是忽略到文档这个层次。

@88250
Copy link
Member

88250 commented Sep 17, 2023

后者也支持 id 过滤,可以到块。再考虑一段时间,看看是否有更多需求。

@88250 88250 changed the title 为 SearchRefBlock 功能添加黑名单 Support configuring non-data indexing and search filtering Sep 17, 2023
@88250 88250 self-assigned this Sep 17, 2023
@88250 88250 added this to the backlog milestone Sep 17, 2023
@LoneFireBlossom
Copy link

LoneFireBlossom commented Sep 17, 2023

双链笔记本来主打的就是互相连接吧,楼主的意思是会有已经「从链接毕业」的笔记,纯好奇能不能举个例子。

我随便想了一个。
我是小学生,学了加法,思源笔记里一堆链接到加法的。
后来上了初中,不需要再链接这么简单的内容了(明明我会还让我敲俩【【是做无用功),所以就不想让它显示了。
但是以后还是会学二进制里的加法之类加法衍生出来的东西,感觉还是有机会链接的。

再想了想,不想链接到模板?

又或者,那种整天用素材输出一大堆论据差不多的文章的。比如经济学的答主在知乎各个房地产相关问题下分析,如果积极回答的话那每个回答核心都差不多是那一套。

@HoollyFox
Copy link

支持,另外建议在搜索设置中设置黑名单,不和引用列表 共用 黑名单,因为有的内容不想搜索时看到,但是想引用时看到。

这个需求挺大的,因为有很多在网上收集的文章,但是不想作为引用材料或者搜索材料,只想自己特定地块引用。

@TCOTC
Copy link
Contributor

TCOTC commented Nov 27, 2023

@88250

This comment was marked as outdated.

@88250
Copy link
Member

88250 commented Jan 6, 2024

经过一段时间的考虑,方案如下:

  • data/.siyuan/indexignore:用于忽略索引
  • data/.siyuan/searchignore:用于忽略全局搜索
  • data/.siyuan/refsearchignore:用于忽略引用搜索

这些 ignore 配置文件的语法和 syncignore 一致,即使用 gitignore 语法。

@88250 88250 changed the title Support configuring non-data indexing and search filtering Support ignore index Jan 6, 2024
@88250
Copy link
Member

88250 commented Jan 6, 2024

搜索任务拆分到 #10089

88250 added a commit that referenced this issue Jan 6, 2024
@88250 88250 closed this as completed Jan 6, 2024
EightDoor added a commit to EightDoor/siyuan that referenced this issue Jan 7, 2024
* commit '796df799315490e3a9d6e045f1c6bc98fb661e45': (455 commits)
  🐛 Fix `name` attribute could not be visited in the plugin constructor (siyuan-note#10071)
  🎨 Support ignore index siyuan-note#9198
  ♻️ Rename func
  🎨 siyuan-note#10090
  🎨 Reduce the delay in adding rows in database table view siyuan-note#10082
  🎨 Reduce the delay in adding rows in database table view siyuan-note#10082
  🎨 siyuan-note#10065
  🎨 Cards expired no longer appear in the same review round siyuan-note#10087
  🎨 https://ld246.com/article/1704285860053/comment/1704528635155#comments
  🐛 fix siyuan-note#10088
  🎨 https://ld246.com/article/1704285860053
  🎨 fix siyuan-note#10086
  🎨 fix siyuan-note#10085
  🎨 fix siyuan-note#10048
  🎨 Add internal kernel API `/api/filetree/upsertIndexes` and `/api/filetree/removeIndexes` siyuan-note#10079
  🎨 fix siyuan-note#10083
  ⬆️ Upgrade kernel deps
  ⬆️ Upgrade kernel deps
  🎨 fix siyuan-note#10000
  🎨 siyuan-note#10065
  ...

# Conflicts:
#	app/src/util/needSubscribe.ts
#	kernel/model/conf.go
@88250 88250 modified the milestones: backlog, 2.12.1 Jan 9, 2024
@TinkMingKing
Copy link
Contributor

TinkMingKing commented Jan 10, 2024

@88250 请问三种忽略方式的区别是怎样的,忽略全局搜索、忽略引用搜索这两个还好,主要有点不太理解忽略索引

@88250
Copy link
Member

88250 commented Jan 10, 2024

  • 忽略索引:完全不会编入数据库索引
  • 忽略搜索:编入数据库索引,但是搜索时过滤

@tcmtom
Copy link

tcmtom commented Jan 15, 2024

进入忽略索引的文件会被同步吗?

@88250
Copy link
Member

88250 commented Jan 15, 2024 via email

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

No branches or pull requests

7 participants