mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🐛 在提及中搜索不到结果问题 Fix https://github.com/siyuan-note/siyuan/issues/5236
This commit is contained in:
parent
e533b24f3d
commit
9e886910df
1 changed files with 8 additions and 4 deletions
|
|
@ -358,19 +358,23 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
||||||
buf.WriteString(" OR ")
|
buf.WriteString(" OR ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf.WriteString(")'")
|
buf.WriteString(")")
|
||||||
if "" != keyword {
|
if "" != keyword {
|
||||||
buf.WriteString(" AND MATCH '{content}:'")
|
|
||||||
buf.WriteString("\"" + keyword + "\"")
|
|
||||||
keyword = strings.ReplaceAll(keyword, "\"", "\"\"")
|
keyword = strings.ReplaceAll(keyword, "\"", "\"\"")
|
||||||
|
buf.WriteString(" AND (\"" + keyword + "\")")
|
||||||
}
|
}
|
||||||
|
buf.WriteString("'")
|
||||||
buf.WriteString(" AND root_id != '" + rootID + "'") // 不在定义块所在文档中搜索
|
buf.WriteString(" AND root_id != '" + rootID + "'") // 不在定义块所在文档中搜索
|
||||||
buf.WriteString(" AND type IN ('d', 'h', 'p', 't')")
|
buf.WriteString(" AND type IN ('d', 'h', 'p', 't')")
|
||||||
buf.WriteString(" ORDER BY id DESC LIMIT " + strconv.Itoa(Conf.Search.Limit))
|
buf.WriteString(" ORDER BY id DESC LIMIT " + strconv.Itoa(Conf.Search.Limit))
|
||||||
query := buf.String()
|
query := buf.String()
|
||||||
|
|
||||||
sqlBlocks := sql.SelectBlocksRawStmt(query, Conf.Search.Limit)
|
sqlBlocks := sql.SelectBlocksRawStmt(query, Conf.Search.Limit)
|
||||||
blocks := fromSQLBlocks(&sqlBlocks, strings.Join(mentionKeywords, search.TermSep), beforeLen)
|
terms := mentionKeywords
|
||||||
|
if "" != keyword {
|
||||||
|
terms = append(terms, keyword)
|
||||||
|
}
|
||||||
|
blocks := fromSQLBlocks(&sqlBlocks, strings.Join(terms, search.TermSep), beforeLen)
|
||||||
|
|
||||||
// 排除链接文本 https://github.com/siyuan-note/siyuan/issues/1542
|
// 排除链接文本 https://github.com/siyuan-note/siyuan/issues/1542
|
||||||
luteEngine := NewLute()
|
luteEngine := NewLute()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue