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": "20220415232231-pqcizol",
"Spec": "2",
"Type": "NodeDocument",
"Properties": {
"id": "20220415232231-pqcizol",
"title": "Query syntax",
"type": "doc",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232239-abvrkg2",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415232239-abvrkg2",
"updated": "20261024163429"
},
"Children": [
{
"Type": "NodeText",
"Data": "Overview"
}
]
},
{
"ID": "20220415232239-xvsiw7v",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-xvsiw7v",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "Choose Query syntax in global search to combine conditions with "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "OR"
},
{
"Type": "NodeText",
"Data": ", and "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "NOT"
},
{
"Type": "NodeText",
"Data": ". For example, "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "foo NOT bar"
},
{
"Type": "NodeText",
"Data": " finds content containing "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "foo"
},
{
"Type": "NodeText",
"Data": " but not "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "bar"
},
{
"Type": "NodeText",
"Data": "."
}
]
},
{
"ID": "20220415232239-bf83mru",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-bf83mru",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "Query syntax has three building blocks:"
}
]
},
{
"ID": "20220415232239-2eww0wd",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20220415232239-2eww0wd",
"updated": "20261024163429"
},
"Children": [
{
"ID": "20220415232239-pt2gqk2",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-pt2gqk2",
"updated": "20261024163429"
},
"Children": [
{
"ID": "20220415232239-o9y45xb",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-o9y45xb",
"updated": "20261024163429"
},
"Children": [
{
"Type": "NodeText",
"Data": "String: composed of letters, numbers, etc"
}
]
}
]
},
{
"ID": "20220415232239-vz9o00o",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-vz9o00o",
"updated": "20220415232239"
},
"Children": [
{
"ID": "20220415232239-couxrbd",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-couxrbd",
"updated": "20220415232239"
},
"Children": [
{
"Type": "NodeText",
"Data": "Phrase: composed of strings"
}
]
}
]
},
{
"ID": "20220415232239-7lyjjlg",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-7lyjjlg",
"updated": "20220415232239"
},
"Children": [
{
"ID": "20220415232239-ecoeyl1",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-ecoeyl1",
"updated": "20220415232239"
},
"Children": [
{
"Type": "NodeText",
"Data": "Query: composed of phrases, multiple queries can be combined into a new query through "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "OR"
},
{
"Type": "NodeText",
"Data": " and "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "NOT"
}
]
}
]
}
]
},
{
"ID": "20220415232239-91we456",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-91we456",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "The following sections explain strings and phrases, then show how to combine them into queries."
}
]
},
{
"ID": "20220415232239-9x4gcsx",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415232239-9x4gcsx",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "Strings"
}
]
},
{
"ID": "20220415232239-iffq145",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-iffq145",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "Strings can be written in two ways:"
}
]
},
{
"ID": "20220415232239-bf52gq4",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20220415232239-bf52gq4",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232239-9obi3e2",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-9obi3e2",
"updated": "20261024161058"
},
"Children": [
{
"ID": "20220415232239-o7glmzf",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-o7glmzf",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "Enclose a string in double quotes ("
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\""
},
{
"Type": "NodeText",
"Data": "). Write a double quote inside the string twice. For example, "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "\"foo\"\"bar\"\"\""
},
{
"Type": "NodeText",
"Data": " represents "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "foo\"bar\""
}
]
}
]
},
{
"ID": "20220415232239-7znuuq7",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-7znuuq7",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232239-21ckvvg",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-21ckvvg",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "An unquoted string must not be a reserved word ("
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "OR"
},
{
"Type": "NodeText",
"Data": ", or "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "NOT"
},
{
"Type": "NodeText",
"Data": ") and may contain only the following characters:"
}
]
},
{
"ID": "20220415232239-yrossym",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20220415232239-yrossym",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232239-eyybo63",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-eyybo63",
"updated": "20220415232603"
},
"Children": [
{
"ID": "20220415232239-13cj18b",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-13cj18b",
"updated": "20220415232603"
},
"Children": [
{
"Type": "NodeText",
"Data": "All non-ASCII characters, or"
}
]
}
]
},
{
"ID": "20220415232239-55fpsg3",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-55fpsg3",
"updated": "20220415232239"
},
"Children": [
{
"ID": "20220415232239-eu59o1h",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-eu59o1h",
"updated": "20220415232239"
},
"Children": [
{
"Type": "NodeText",
"Data": "Belongs to 52 uppercase and lowercase English characters ("
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "A-Za-z"
},
{
"Type": "NodeText",
"Data": "), or"
}
]
}
]
},
{
"ID": "20220415232239-yvsjx0l",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-yvsjx0l",
"updated": "20220415232239"
},
"Children": [
{
"ID": "20220415232239-9gzzt33",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-9gzzt33",
"updated": "20220415232239"
},
"Children": [
{
"Type": "NodeText",
"Data": "Belongs to 10 ASCII numeric characters ("
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "0-9"
},
{
"Type": "NodeText",
"Data": "), or"
}
]
}
]
},
{
"ID": "20220415232239-77g2mfa",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-77g2mfa",
"updated": "20220415232615"
},
"Children": [
{
"ID": "20220415232239-4d0b287",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-4d0b287",
"updated": "20220415232615"
},
"Children": [
{
"Type": "NodeText",
"Data": "Is an underscore "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "_"
},
{
"Type": "NodeText",
"Data": ", or"
}
]
}
]
},
{
"ID": "20220415232239-gtmvftf",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220415232239-gtmvftf",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20220415232239-lalwhj7",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-lalwhj7",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "The control character U+001A (SUB)"
}
]
}
]
}
]
}
]
}
]
},
{
"ID": "20220415232239-3nnn6m9",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-3nnn6m9",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "Enclose strings containing spaces, "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "-"
},
{
"Type": "NodeText",
"Data": ", or other characters outside this set in double quotes. Symbols such as "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "*"
},
{
"Type": "NodeText",
"Data": " can also be query operators, so distinguish literal strings from query syntax."
}
]
},
{
"ID": "20220415232239-nln4l9x",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415232239-nln4l9x",
"updated": "20261024161816"
},
"Children": [
{
"Type": "NodeText",
"Data": "Phrases"
}
]
},
{
"ID": "20220415232239-eewj58z",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-eewj58z",
"updated": "20261024161816"
},
"Children": [
{
"Type": "NodeText",
"Data": "A phrase consists of strings joined with "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "+"
},
{
"Type": "NodeText",
"Data": ". The tokenizer turns the input into tokens, and a phrase requires those tokens to match next to each other in order. Use "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": " when several keywords must appear but do not need to be adjacent."
}
]
},
{
"ID": "20220415232239-rrjlw3p",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415232239-rrjlw3p",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "Queries"
}
]
},
{
"ID": "20220415232239-37vz7jx",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-37vz7jx",
"updated": "20220415232239"
},
"Children": [
{
"Type": "NodeText",
"Data": "A query consists of multiple phrases, which can be combined into a new query by the operators "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": ", "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "OR"
},
{
"Type": "NodeText",
"Data": ", and "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "NOT"
},
{
"Type": "NodeText",
"Data": "."
}
]
},
{
"ID": "20220415232838-yxo6xjb",
"Type": "NodeTable",
"TableAligns": [
0,
0
],
"Properties": {
"colgroup": "|",
"id": "20220415232838-yxo6xjb",
"updated": "20220415233221"
},
"Children": [
{
"Type": "NodeTableHead",
"Data": "thead",
"Children": [
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "Operator"
}
]
},
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "Function"
}
]
}
]
}
]
},
{
"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": "Matches if both query1 and query2 match"
}
]
}
]
},
{
"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": "Matches if either query1 or query2 match"
}
]
}
]
},
{
"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": "Matches if query1 matches and query2 does not match"
}
]
}
]
}
]
},
{
"ID": "20220415232239-muzrygb",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-muzrygb",
"updated": "20220415232239"
},
"Children": [
{
"Type": "NodeText",
"Data": "Use parentheses "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "()"
},
{
"Type": "NodeText",
"Data": " to combine query priorities, for example:"
}
]
},
{
"ID": "20220415232239-3z0w5v1",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20220415232239-3z0w5v1",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
"Type": "NodeCodeBlockCode",
"Data": "-- NOT takes precedence over OR; use parentheses to make grouping explicit.\n-- Matches documents that contain at least one instance of either \"one\" or \"two\", but do not contain any instances of token \"three\".\n'(one OR two) NOT three'\n\n-- Match all documents that contain the token \"two\" but not \"three\", or contain the token \"one\".\n'one OR (two NOT three)'\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20220415232239-sjz7nbl",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415232239-sjz7nbl",
"updated": "20220415232239"
},
"Children": [
{
"Type": "NodeText",
"Data": "Multiple phrases separated by spaces use "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "AND"
},
{
"Type": "NodeText",
"Data": " by default, for example:"
}
]
},
{
"ID": "20220415232239-axj842d",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20220415232239-axj842d",
"updated": "20220502163624"
},
"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'NEAR(one two) three' -- 'NEAR(one two) AND three'\n'one OR two three' -- 'one OR two AND three'\n\n'(one OR two) three' -- Syntax error!\n'func(one two)' -- Syntax error!\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20220415233433-mnuypxn",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20220415233433-mnuypxn",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "Technical implementation"
}
]
},
{
"ID": "20220415233433-qwsmc8y",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415233433-qwsmc8y",
"updated": "20220415233433"
},
"Children": [
{
"Type": "NodeText",
"Data": "We implement global search through "
},
{
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://www.sqlite.org/fts5.html",
"TextMarkTextContent": "SQLite FTS5"
},
{
"Type": "NodeText",
"Data": "."
}
]
},
{
"ID": "20220415233433-63nplm9",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415233433-63nplm9",
"updated": "20261024161058"
},
"Children": [
{
"Type": "NodeText",
"Data": "The attribute options in "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Settings"
},
{
"Type": "NodeText",
"Data": " - "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Search"
},
{
"Type": "NodeText",
"Data": " determine which properties are searched. FTS5 column filters specify that scope: "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "{content name alias memo}:foo"
},
{
"Type": "NodeText",
"Data": " searches for "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "foo"
},
{
"Type": "NodeText",
"Data": " in content, names, aliases, and memos. A complete SQL example is "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "SELECT * FROM blocks_fts WHERE blocks_fts MATCH '{content name alias memo}:foo'"
},
{
"Type": "NodeText",
"Data": "."
}
]
},
{
"ID": "20220415233433-n86851p",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415233433-n86851p",
"updated": "20220415233433"
},
"Children": [
{
"Type": "NodeText",
"Data": "After knowing these, we can implement the query embedding block through the query syntax, so that the query performance will be better:"
}
]
},
{
"ID": "20220415233433-411i0bp",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20220415233433-411i0bp",
"updated": "20220415234441"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks_fts WHERE blocks_fts MATCH 'content:query syntax' AND root_id = '20220415232231-pqcizol' LIMIT 1\n"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20220415233433-y5pcphn",
"Type": "NodeParagraph",
"Properties": {
"id": "20220415233433-y5pcphn",
"updated": "20220415233433"
},
"Children": [
{
"Type": "NodeText",
"Data": "In addition to this, the API also supports querying using FTS."
}
]
},
{
"ID": "20260613193430-9q9g9da",
"Type": "NodeParagraph",
"Properties": {
"id": "20260613193430-9q9g9da",
"updated": "20260613193430"
}
}
]
}