mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
🎨 改进搜索指定路径后不指定关键字的行为 Fix https://github.com/siyuan-note/siyuan/issues/6959
This commit is contained in:
parent
883de52882
commit
22a233d9b8
1 changed files with 3 additions and 2 deletions
|
|
@ -603,7 +603,7 @@ func fullTextSearchByRegexp(exp, boxFilter, pathFilter, typeFilter, orderBy stri
|
|||
exp = regexp.QuoteMeta(exp)
|
||||
|
||||
fieldFilter := fieldRegexp(exp)
|
||||
stmt := "SELECT * FROM `blocks` WHERE (" + fieldFilter + ") AND type IN " + typeFilter
|
||||
stmt := "SELECT * FROM `blocks` WHERE " + fieldFilter + " AND type IN " + typeFilter
|
||||
stmt += boxFilter + pathFilter
|
||||
stmt += " " + orderBy
|
||||
stmt += " LIMIT " + strconv.Itoa(Conf.Search.Limit)
|
||||
|
|
@ -808,6 +808,7 @@ func maxContent(content string, maxLen int) string {
|
|||
|
||||
func fieldRegexp(regexp string) string {
|
||||
buf := bytes.Buffer{}
|
||||
buf.WriteString("(")
|
||||
buf.WriteString("content REGEXP '")
|
||||
buf.WriteString(regexp)
|
||||
buf.WriteString("'")
|
||||
|
|
@ -833,7 +834,7 @@ func fieldRegexp(regexp string) string {
|
|||
}
|
||||
buf.WriteString(" OR tag REGEXP '")
|
||||
buf.WriteString(regexp)
|
||||
buf.WriteString("'")
|
||||
buf.WriteString("')")
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue