只需要改第一行的 keywords 变量内的“关键词”,就可以通过使用模板查找关键词了,对于标题是用块引方式展现。
可以根据自己的需要建立一个关键词文件夹,对该模板复制几份,改成不同的常用关键词
汇总本文档内包含关键词的内容块
.action{$keywords := "关键词"}
.action{.title}文档内包含关键词(.action{$keywords})的段落文字汇总
{{SELECT * FROM blocks WHERE path LIKE '%/.action{.id}.sy' AND markdown LIKE '%.action{$keywords}%' AND (type = 'p' AND parent_id not in (SELECT id FROM blocks WHERE path LIKE '%/.action{.id}.sy' AND type = 'i') ) OR (type = 'i' AND id in (SELECT parent_id FROM blocks WHERE path LIKE '%/.action{.id}.sy' AND type ='p' AND markdown LIKE '%.action{$keywords}% ' )) ORDER BY created LIMIT 10000 }}
md 文件
汇总所有子文档内包含关键词的内容块
.action{$keywords := "关键词"}
子文档内包含关键词(.action{$keywords})的段落文字汇总(不包含本文档)
{{SELECT * FROM blocks WHERE path LIKE '%.action{.id}/%' AND markdown LIKE '%.action{$keywords}%' AND ((type = 'p' AND parent_id not in (SELECT id FROM blocks WHERE type = 'i') ) OR (type = 'i' AND id in (SELECT parent_id FROM blocks WHERE type ='p' AND markdown LIKE '%.action{$keywords}%' )) ) ORDER BY created LIMIT 10000 }}
单独以块引展示包含关键词(.action{$keywords})的标题
.action{$block:= (queryBlocks "SELECT * FROM blocks WHERE type= 'h' AND path LIKE '%?/%' AND markdown LIKE '%?%' ORDER BY created LIMIT 10000" .id $keywords)}
.action{range $v:=$block}
- ((.action{$v.ID} ".action{$v.Content}")) (.action{$v.HPath})
.action{end}
汇总所有文档内包含关键词的内容块
搜索所有文档中包含关键词的内容,但不包括此文档
.action{$keywords := "关键词"}
所有文档内包含关键词(.action{$keywords})的段落文字汇总(不包含本文档)
{{SELECT * FROM blocks WHERE path NOT LIKE '%/.action{.id}.sy' AND markdown LIKE '%.action{$keywords}%' AND ((type = 'p' AND parent_id not in (SELECT id FROM blocks WHERE type = 'i') ) OR (type = 'i' AND id in (SELECT parent_id FROM blocks WHERE type ='p' AND markdown LIKE '%.action{$keywords}%' )) ) ORDER BY created LIMIT 10000 }}
单独以块引展示包含关键词(.action{$keywords})的标题
.action{$block:= (queryBlocks "SELECT * FROM blocks WHERE type= 'h' AND path NOT LIKE '%/.action{.id}.sy' AND markdown LIKE '%?%' ORDER BY created LIMIT 10000" $keywords)}
.action{range $v:=$block}
- ((.action{$v.ID} ".action{$v.Content}")) (.action{$v.HPath})
.action{end}
关于模板的更多使用方法见分享:📋 模板使用基本介绍 · 语雀 (yuque.com)
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于