search
This tool covers full-text search, backlinks, SQL reads, asset search, and controlled find-replace operations.
When to read this page: you need to find content across the workspace or query indexed content.
Related pages:
Common Actions
| Group | Actions |
|---|---|
| Text search | fulltext, search_refs |
| Graph / relation | get_backlinks, list_invalid_refs |
| SQL / asset | query_sql, search_assets, fulltext_asset_content |
| Mutating | find_replace |
Safety Rules
find_replaceis the mutating exception in this tool and requires explicit confirmation.query_sqlis read-only and only acceptsSELECTstatements; addLIMITyourself.- Search results are filtered by notebook permissions where applicable.
- Full-text search can lag briefly behind recent writes because indexing is eventually consistent.
Examples
MCP:
json
{
"action": "fulltext",
"query": "meeting notes",
"methodName": "keyword",
"sortBy": "relevance"
}json
{
"action": "query_sql",
"sql": "SELECT id, content, type FROM blocks LIMIT 10"
}CLI:
bash
siyuan search fulltext --query "meeting notes" --method-name keyword --sort-by relevance
siyuan search query-sql --sql "SELECT id, content, type FROM blocks LIMIT 10"Notes for AI callers:
- Prefer semantic aliases such as
methodName,sortBy,query, andsqlover numericmethod/orderByor short legacy fields likek. fulltextreturnsplainContentandexcerptby default, so you do not needstripHtml=truejust to get plain text.- When
parentId,hasTags, or permission filtering are involved,kernel*metadata describes the raw SiYuan search page andreturned*metadata describes the post-filtered data in the current response.
Action List
fulltextquery_sqlget_backlinkssearch_refsfind_replacesearch_assetsfulltext_asset_contentlist_invalid_refs