Skip to content

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

:art: Improve block custom attribute search preview area positioning https://github.com/siyuan-note/siyuan/issues/14061

Daniel6e7168a8f73e
diff --git a/kernel/model/search.go b/kernel/model/search.go
index bec291f50e..e06c3ae430 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -1525,7 +1525,9 @@ func highlightByFTS(query, typeFilter, id string) (ret []string) {
"highlight(" + table + ", 9, '" + search.SearchMarkLeft + "', '" + search.SearchMarkRight + "') AS memo, " +
"highlight(" + table + ", 10, '" + search.SearchMarkLeft + "', '" + search.SearchMarkRight + "') AS tag, " +
"highlight(" + table + ", 11, '" + search.SearchMarkLeft + "', '" + search.SearchMarkRight + "') AS content, " +
- "fcontent, markdown, length, type, subtype, ial, sort, created, updated"
+ "fcontent, markdown, length, type, subtype, " +
+ "highlight(" + table + ", 17, '" + search.SearchMarkLeft + "', '" + search.SearchMarkRight + "') AS ial, " +
+ "sort, created, updated"
stmt := "SELECT " + projections + " FROM " + table + " WHERE (`" + table + "` MATCH '" + columnFilter() + ":(" + query + ")'"
stmt += ") AND type IN " + typeFilter
stmt += " AND root_id = '" + id + "'"
@@ -1552,6 +1554,10 @@ func highlightByFTS(query, typeFilter, id string) (ret []string) {
if 0 < len(keyword) {
ret = append(ret, keyword...)
}
+ keyword = gulu.Str.SubstringsBetween(block.IAL, search.SearchMarkLeft, search.SearchMarkRight)
+ if 0 < len(keyword) {
+ ret = append(ret, keyword...)
+ }
keyword = gulu.Str.SubstringsBetween(block.Content, search.SearchMarkLeft, search.SearchMarkRight)
if 0 < len(keyword) {
ret = append(ret, keyword...)