search
This tool covers full-text and semantic 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, semantic, 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. It preserves every selected column and is available only when every notebook is readable. If any notebook is unreadable, raw SQL is rejected before execution because aggregates, joins, CTEs, and subqueries cannot be safely post-filtered by notebook.- Search results are filtered by notebook permissions where applicable.
- Full-text search can lag briefly behind recent writes because indexing is eventually consistent.
semanticrequires SiYuan 3.7.0+, an enabled embedding model, and a completed native embedding index. Encrypted notebooks are not included in that index.- The plugin's Embedding Model settings page can edit the native configuration on SiYuan 3.7.0–3.7.1. Connection testing, index statistics, rebuild, and failed-item retry require SiYuan 3.7.2+.
Examples
MCP:
json
{
"action": "fulltext",
"query": "meeting notes",
"methodName": "keyword",
"sortBy": "relevance"
}json
{
"action": "semantic",
"query": "ideas related to resilient distributed systems",
"typeShortcodes": ["h", "p"]
}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 semantic --query "ideas related to resilient distributed systems" --type-shortcodes-json '["h","p"]'
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
fulltextsemanticquery_sqlget_backlinkssearch_refsfind_replacesearch_assetsfulltext_asset_contentlist_invalid_refs