Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Block ref search supports searching `'` Fix https://github.com/siyuan-note/siyuan/issues/8886

Daniele01077f30014
diff --git a/kernel/model/search.go b/kernel/model/search.go
index 88f75057a8..06ce3dfbca 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -710,7 +710,7 @@ func fullTextSearchRefBlock(keyword string, beforeLen int, onlyDoc bool) (ret []
when memo LIKE '%${keyword}%' then 90
when content LIKE '%${keyword}%' and type != 'i' and type != 'l' then 100
else 65535 end ASC, sort ASC, length ASC`
- orderBy = strings.ReplaceAll(orderBy, "${keyword}", keyword)
+ orderBy = strings.ReplaceAll(orderBy, "${keyword}", quotedKeyword)
stmt += orderBy + " LIMIT " + strconv.Itoa(Conf.Search.Limit)
blocks := sql.SelectBlocksRawStmtNoParse(stmt, Conf.Search.Limit)
ret = fromSQLBlocks(&blocks, "", beforeLen)