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

Assets hyperlinks are no longer included in the search index #8076

Closed
frostime opened this issue Apr 21, 2023 · 10 comments
Closed

Assets hyperlinks are no longer included in the search index #8076

frostime opened this issue Apr 21, 2023 · 10 comments
Assignees
Milestone

Comments

@frostime
Copy link
Contributor

In what scenarios do you need this feature?

当前我们在搜索面板下是可以搜索到 asset 文件的路径的。我认为这是一种无用的搜索,因为 asset 的路径只在很少情况下才是有意义的,用无意义的路径淹没有意义的信息我认为没有必要。

如图所示,我搜索「bd」,然后搜索结果中大量存在 asset 文件。

image

Describe the optimal solution

在类型过滤中增加对 asset 的过滤选项,允许用户免受 asset 路径的干扰。

Describe the candidate solution

No response

Other information

No response

@88250
Copy link
Member

88250 commented Apr 22, 2023

这个没有办法临时过滤,除非索引时不加入。

@Soltus
Copy link
Contributor

Soltus commented Apr 22, 2023

asset单独一个搜索界面也可以的

@88250
Copy link
Member

88250 commented Apr 22, 2023

关联前期需求:

@frostime
Copy link
Contributor Author

frostime commented Apr 22, 2023

我不太了解 D 大的具体技术困难,但是我认为这个事实是有必要考虑的:「 99% 的情况下 asset 的命名都是没有太多意义的」—— PDF等文件在数量上只是小数,占大多数的永远是图片,而图片的文件名没有多大意义。

增加对 asset 的临时过滤是针对这个问题提出的一个不成熟的方案,也许这个方案没有考虑的价值,但是这个问题本身仍然值得思考。

@88250
Copy link
Member

88250 commented Apr 22, 2023

对于插入的文件命名有两种情况:

  • 手动命名过的:比如重要的图片
  • 随机生成的:比如截图程序生成的,或者是剪藏网页中的

过滤是实现不了啦,要搞的话只能在索引时就不加入索引,这样就所有资源文件的链接都无法搜索到,也许细化一点可以改进为某些资源文件(比如 .docx,/.pdf 等)进入索引,图片不索引。但是按后缀细化的方案也有缺点,不够灵活……

目前我个人更倾向于所有资源文件都不要索引链接部分,因为资源文件可以设置文本部分:

  • 资源文件超链接:支持设置 锚文 和 标题
  • 资源文件图片:支持设置 标题 和 提示文本

这些设置都是纳入索引的,实际上已经能够解决搜索需求。

所以我们是不是考虑可以移除资源文件超链接部分的索引?

@frostime
Copy link
Contributor Author

我基本同意。按照我的测试情况来看:

  1. 绝大部分人导入文件都是直接拖进编辑器,而拖进编辑器的文件会自动填写「锚文本」。所以对图片以外的资源文件只需要索引锚文本就可以直接搜到原文件名。
    image
    image

  2. 对图片而言,导入编辑器的时候会自动填写「提示文本」

image
image

大部分情况下我们会搜索的往往是 PDF 这些文件名有意义的资源,所以去掉链接应该几乎不会有任何影响。

@88250
Copy link
Member

88250 commented Apr 22, 2023

@Zuoqiu-Yingyi 你认为呢?

@88250 88250 changed the title 搜索过滤中增加对「asset」的过滤 Assets hyperlinks are no longer included in the search index Apr 22, 2023
@Zuoqiu-Yingyi
Copy link
Contributor

Zuoqiu-Yingyi commented Apr 22, 2023

@Zuoqiu-Yingyi 你认为呢?

最好在建立倒排索引时仅排除内部的资源链接 assets/*, 外部的链接还是需要保留的

@88250
Copy link
Member

88250 commented Apr 22, 2023

好的,那就如此吧。

@88250 88250 self-assigned this Apr 22, 2023
@88250 88250 added this to the 2.8.6 milestone Apr 22, 2023
@88250 88250 closed this as completed Apr 22, 2023
@TWQM
Copy link

TWQM commented May 8, 2023

请问这个功能现在确认是取消了吗?我在更新2.8.6之后发现无法搜索assets,检查更新列表之后发现这个功能被移除。

但我实际工作中会将文件归类放入assets下的子目录,当对子目录进行重新归类迁移时搜索assets并批量替换的操作非常重要。

我最开始使用思源笔记时也习惯将文件直接拖入,但使用一段时间后我发现大量文件集中在assets根目录下导致从文件夹寻找文件变得非常困难。

特别是在处理excel文件时,我希望可以直接通过打开文件夹的方式对其进行编辑,而不用每次都通过笔记搜索进行打开。

我想最佳的实现方案是将assets作为一个搜索类型,并在搜索框中的类型按钮中进行选择。但我不确定这样的实现在编程中是否可行或非常困难,一个替代方案是将此功能在beta版本中保留。

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

5 participants