An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
{
"ID": "20220415232129-shpzg6r",
"Spec": "2",
"Type": "NodeDocument",
"Properties": {
"id": "20220415232129-shpzg6r",
"title": "查詢語法",
"type": "doc",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232130-xmz5ru1",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415232130-xmz5ru1",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "概述"
}
]
},
{
"ID": "20220415232130-5qj6u53",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-5qj6u53",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "在全域搜尋中選擇「查詢語法」,可以透過 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": "、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "OR"
},
{
"Type": "NodeText",
"Data": "、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "NOT"
},
{
"Type": "NodeText",
"Data": " 組合條件。例如,"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "foo NOT bar"
},
{
"Type": "NodeText",
"Data": " 用於尋找包含 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "foo"
},
{
"Type": "NodeText",
"Data": " 且不包含 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "bar"
},
{
"Type": "NodeText",
"Data": " 的內容。"
}
]
},
{
"ID": "20220415232130-53umaqt",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-53umaqt",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢語法由以下三部分組成:"
}
]
},
{
"ID": "20220415232130-sjv3dwi",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20220415232130-sjv3dwi",
"updated": "20220415232130"
},
"Children": [
{
"ID": "20220415232130-9b4w3og",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-9b4w3og",
"updated": "20220415232130"
},
"Children": [
{
"ID": "20220415232130-qy976q2",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-qy976q2",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "字符串(String):由字母、數字等構成"
}
]
}
]
},
{
"ID": "20220415232130-ej603q9",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-ej603q9",
"updated": "20220415232130"
},
"Children": [
{
"ID": "20220415232130-vx8dy47",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-vx8dy47",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "短語(Phrase):由字符串構成"
}
]
}
]
},
{
"ID": "20220415232130-4kci7nt",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-4kci7nt",
"updated": "20220415232130"
},
"Children": [
{
"ID": "20220415232130-nmaaomd",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-nmaaomd",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢(Query):由短語構成,多個查詢可通過 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": "、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "OR"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "NOT"
},
{
"Type": "NodeText",
"Data": " 組合為新的查詢"
}
]
}
]
}
]
},
{
"ID": "20220415232130-rvoj3hc",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-rvoj3hc",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "下面先介紹字串和短語,再說明如何組合成查詢。"
}
]
},
{
"ID": "20220415232130-9kj1wuk",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415232130-9kj1wuk",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "字符串"
}
]
},
{
"ID": "20220415232130-vagd1i0",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-vagd1i0",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "字串有兩種寫法:"
}
]
},
{
"ID": "20220415232130-yakp8k5",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20220415232130-yakp8k5",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232130-8hskkz0",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-8hskkz0",
"updated": "20261024161058"
},
"Children": [
{
"ID": "20220415232130-0vqgg1n",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-0vqgg1n",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "用半形雙引號 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\""
},
{
"Type": "NodeText",
"Data": " 包圍字串;字串中的雙引號寫成兩個連續的雙引號。例如,"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\"foo\"\"bar\"\"\""
},
{
"Type": "NodeText",
"Data": " 表示 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "foo\"bar\""
}
]
}
]
},
{
"ID": "20220415232130-bcu3zgh",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-bcu3zgh",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232130-uww9hbt",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-uww9hbt",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "不加引號的字串不能是保留字 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": "、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "OR"
},
{
"Type": "NodeText",
"Data": "、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "NOT"
},
{
"Type": "NodeText",
"Data": ",且只能包含以下字元:"
}
]
},
{
"ID": "20220415232130-wpjyda1",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20220415232130-wpjyda1",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232130-bu8gsv3",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-bu8gsv3",
"updated": "20220415232130"
},
"Children": [
{
"ID": "20220415232130-6wfi1an",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-6wfi1an",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "所有非 ASCII 字符,或者"
}
]
}
]
},
{
"ID": "20220415232130-6bqogq0",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-6bqogq0",
"updated": "20220415232130"
},
"Children": [
{
"ID": "20220415232130-l58rfkk",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-l58rfkk",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "屬於 52 個大小寫英文字符("
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "A-Za-z"
},
{
"Type": "NodeText",
"Data": "),或者"
}
]
}
]
},
{
"ID": "20220415232130-oa75cwl",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-oa75cwl",
"updated": "20220415232130"
},
"Children": [
{
"ID": "20220415232130-ywrok9g",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-ywrok9g",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "屬於 10 個 ASCII 數字字符("
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "0-9"
},
{
"Type": "NodeText",
"Data": "),或者"
}
]
}
]
},
{
"ID": "20220415232130-nitrkva",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-nitrkva",
"updated": "20220415232130"
},
"Children": [
{
"ID": "20220415232130-sueyqbn",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-sueyqbn",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "是下劃線 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "_"
},
{
"Type": "NodeText",
"Data": ",或者"
}
]
}
]
},
{
"ID": "20220415232130-w7gxvjj",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232130-w7gxvjj",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232130-4y6q8k3",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-4y6q8k3",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "控制字元 U+001A(SUB)"
}
]
}
]
}
]
}
]
}
]
},
{
"ID": "20220415232130-epl1ak1",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-epl1ak1",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "要將包含空格、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "-"
},
{
"Type": "NodeText",
"Data": " 等字元的內容作為字串使用,須用雙引號包圍。"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "*"
},
{
"Type": "NodeText",
"Data": " 等符號還可能具有查詢語法含義,使用時請區分字串與運算子。"
}
]
},
{
"ID": "20220415232130-oob09dq",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415232130-oob09dq",
"updated": "20261024161816"
},
"Children": [
{
"Type": "NodeText",
"Data": "短語"
}
]
},
{
"ID": "20220415232130-go31ixg",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-go31ixg",
"updated": "20261024161816"
},
"Children": [
{
"Type": "NodeText",
"Data": "短語由字串組成,可用 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "+"
},
{
"Type": "NodeText",
"Data": " 連接。分詞器會將輸入轉為詞元,短語要求這些詞元依序相鄰匹配。如果只需要多個關鍵字同時出現,而不要求相鄰,請使用 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": " 組合查詢。"
}
]
},
{
"ID": "20220415232130-6qdgw35",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415232130-6qdgw35",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢"
}
]
},
{
"ID": "20220415232130-koepoda",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-koepoda",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢由多個短語構成,可通過操作符 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": "、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "OR"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "NOT"
},
{
"Type": "NodeText",
"Data": " 組合為新的查詢。"
}
]
},
{
"ID": "20220415233043-ic38ywg",
"Type": "NodeTable",
"TableAligns": [
0,
0
],
"Properties": {
"colgroup": "|",
"id": "20220415233043-ic38ywg",
"updated": "20220415233043"
},
"Children": [
{
"Type": "NodeTableHead",
"Data": "thead",
"Children": [
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "操作符"
}
]
},
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "功能"
}
]
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "<query1> AND <query2>"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "query1 和 query2 同時匹配"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "<query1> OR <query2>"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "query1 或者 query2 匹配"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "<query1> NOT <query2>"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "query1 匹配同時 query2 不匹配"
}
]
}
]
}
]
},
{
"ID": "20220415232130-365q5as",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-365q5as",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "使用英文圓括號 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "()"
},
{
"Type": "NodeText",
"Data": " 可以組合查詢的優先級,例如:"
}
]
},
{
"ID": "20220415232130-8ymwyjm",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20220415232130-8ymwyjm",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
"Type": "NodeCodeBlockCode",
"Data": "-- NOT 的優先順序高於 OR,請使用括號明確分組。\n-- 匹配包含 \"one\" 或者 \"two\" 的區塊,不匹配包含 \"three\" 的區塊\n'(one OR two) NOT three'\n\n-- 匹配包含 \"one\" 或者包含 \"two\" 且不包含 \"three\" 的區塊\n'one OR (two NOT three)'\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20220415232130-7a9cd6e",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-7a9cd6e",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "使用空格分隔的多個短語預設使用 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": " 連接,比如:"
}
]
},
{
"ID": "20220415232130-mdy457p",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20220415232130-mdy457p",
"updated": "20220502163604"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
"Type": "NodeCodeBlockCode",
"Data": "'one two three' -- 'one AND two AND three'\n'three \"one two\"' -- 'three AND \"one two\"'\n'one OR two three' -- 'one OR two AND three'\n\n'(one OR two) three' -- 語法錯誤!\n'func(one two)' -- 語法錯誤!\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20220415232130-1juhjxd",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415232130-1juhjxd",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "技術實現"
}
]
},
{
"ID": "20220415232130-1w366ul",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-1w366ul",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "我們通過 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://www.sqlite.org/fts5.html",
"TextMarkTextContent": "SQLite FTS5"
},
{
"Type": "NodeText",
"Data": " 實現了全域搜索。"
}
]
},
{
"ID": "20220415232130-kdii2n4",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-kdii2n4",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "搜尋屬性由 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "設定"
},
{
"Type": "NodeText",
"Data": " - "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "搜尋"
},
{
"Type": "NodeText",
"Data": " 中的屬性選項決定。FTS5 使用欄位篩選指定範圍,例如 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "{content name alias memo}:foo"
},
{
"Type": "NodeText",
"Data": " 表示在正文、命名、別名和備註中搜尋 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "foo"
},
{
"Type": "NodeText",
"Data": "。在 SQL 中,完整寫法如 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SELECT * FROM blocks_fts WHERE blocks_fts MATCH '{content name alias memo}:foo'"
},
{
"Type": "NodeText",
"Data": "。"
}
]
},
{
"ID": "20220415232130-ecl8s30",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-ecl8s30",
"updated": "20260730184353"
},
"Children": [
{
"Type": "NodeText",
"Data": "了解到這些以後,我們就可以通過查詢語法來實現查詢嵌入區塊,這樣查詢性能會更好:"
}
]
},
{
"ID": "20220415232130-b00vpj4",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20220415232130-b00vpj4",
"updated": "20220415234510"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks_fts WHERE blocks_fts MATCH 'content:Query Syntax' AND root_id = '20220415232129-shpzg6r' LIMIT 1"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20220415232130-rbkk4ko",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232130-rbkk4ko",
"updated": "20220415232130"
},
"Children": [
{
"Type": "NodeText",
"Data": "除此以外,API 也支持使用 FTS 查詢。"
}
]
},
{
"ID": "20260613193329-bossusf",
"Type": "NodeParagraph",
"Properties": {
"id": "20260613193329-bossusf",
"updated": "20260613193329"
}
}
]
}