🐛 搜索设置忽略大小写时结果统计不正确 Fix https://github.com/siyuan-note/siyuan/issues/6664

This commit is contained in:
Liang Ding 2022-11-21 10:19:56 +08:00
parent 844491d5f1
commit 4650eec7c6
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -378,7 +378,12 @@ func fullTextSearchCount(query, box, path, filter string) (matchedBlockCount, ma
return
}
stmt := "SELECT COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` FROM `blocks_fts` WHERE `blocks_fts` MATCH '" + columnFilter() + ":(" + query + ")' AND type IN " + filter
table := "blocks_fts" // 大小写敏感
if !Conf.Search.CaseSensitive {
table = "blocks_fts_case_insensitive"
}
stmt := "SELECT COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` FROM `" + table + "` WHERE `" + table + "` MATCH '" + columnFilter() + ":(" + query + ")' AND type IN " + filter
if "" != box {
stmt += " AND box = '" + box + "'"
}