From 411a99fb0eb89995dec06c5689d51e83e1f5bf8b Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 15 Feb 2023 18:40:16 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=96=87=E6=A1=A3=E5=90=8D=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E5=BC=95=E7=94=A8=E9=81=B5=E5=BE=AA=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=86=99=E8=AE=BE=E7=BD=AE=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/7372?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/sql/block_query.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/sql/block_query.go b/kernel/sql/block_query.go index 484752073..a52c5d41f 100644 --- a/kernel/sql/block_query.go +++ b/kernel/sql/block_query.go @@ -247,7 +247,11 @@ func queryAliases() (ret []string) { func queryDocIDsByTitle(title string, excludeIDs []string) (ret []string) { ret = []string{} notIn := "('" + strings.Join(excludeIDs, "','") + "')" - sqlStmt := "SELECT id FROM blocks WHERE type = 'd' AND content = ? AND id NOT IN " + notIn + " LIMIT ?" + + sqlStmt := "SELECT id FROM blocks WHERE type = 'd' AND content LIKE ? AND id NOT IN " + notIn + " LIMIT ?" + if caseSensitive { + sqlStmt = "SELECT id FROM blocks WHERE type = 'd' AND content = ? AND id NOT IN " + notIn + " LIMIT ?" + } rows, err := query(sqlStmt, title, 32) if nil != err { logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)