🎨 虚拟引用和反链提及大小写敏感遵循搜索设置 Fix https://github.com/siyuan-note/siyuan/issues/6181

This commit is contained in:
Liang Ding 2022-10-13 20:02:18 +08:00
parent aa094e549d
commit 2c610c2bad
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 20 additions and 9 deletions

View file

@ -195,7 +195,11 @@ func QueryBlockDefIDsByRefText(refText string, excludeIDs []string) (ret []strin
func queryDefIDsByDefText(keyword string, excludeIDs []string) (ret []string) {
ret = []string{}
notIn := "('" + strings.Join(excludeIDs, "','") + "')"
rows, err := query("SELECT DISTINCT(def_block_id) FROM refs WHERE content = ? AND def_block_id NOT IN "+notIn, keyword)
q := "SELECT DISTINCT(def_block_id) FROM refs WHERE content LIKE ? AND def_block_id NOT IN " + notIn
if caseSensitive {
q = "SELECT DISTINCT(def_block_id) FROM refs WHERE content = ? AND def_block_id NOT IN " + notIn
}
rows, err := query(q, keyword)
if nil != err {
logging.LogErrorf("sql query failed: %s", err)
return