只需要改第一行的keywords变量内的“关键词”为自己需要的词语,就可以通过使用模板查找关键词了,对于标题是用块引方式展现。
可以根据自己的需要建立一个关键词文件夹,对该模板复制几份,改成不同的常用关键词

汇总本文档内包含关键词的内容块

  1. .action{$keywords := "关键词"}
  2. .action{.title}文档内包含关键词(.action{$keywords})的段落文字汇总
  3. {{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文件
doc_contain_keywords.md

汇总所有子文档内包含关键词的内容块

  1. .action{$keywords := "关键词"}
  2. 子文档内包含关键词(.action{$keywords})的段落文字汇总(不包含本文档)
  3. {{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 }}
  4. 单独以块引展示包含关键词(.action{$keywords})的标题
  5. .action{$block:= (queryBlocks "SELECT * FROM blocks WHERE type= 'h' AND path LIKE '%?/%' AND markdown LIKE '%?%' ORDER BY created LIMIT 10000" .id $keywords)}
  6. .action{range $v:=$block}
  7. - ((.action{$v.ID} ".action{$v.Content}")) (.action{$v.HPath})
  8. .action{end}

subdoc_contain_keywords.md

汇总所有文档内包含关键词的内容块

搜索所有文档中包含关键词的内容,但不包括此文档

  1. .action{$keywords := "关键词"}
  2. 所有文档内包含关键词(.action{$keywords})的段落文字汇总(不包含本文档)
  3. {{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 }}
  4. 单独以块引展示包含关键词(.action{$keywords})的标题
  5. .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)}
  6. .action{range $v:=$block}
  7. - ((.action{$v.ID} ".action{$v.Content}")) (.action{$v.HPath})
  8. .action{end}

all_contain_keywords.md.md