mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-28 11:16:09 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
a5542134e9
1 changed files with 4 additions and 3 deletions
|
|
@ -543,6 +543,7 @@ func fullTextSearch(query, box, path, typeFilter string, beforeLen int, querySyn
|
|||
|
||||
func fullTextSearchByRegexp(exp, box, path, typeFilter string, beforeLen int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
|
||||
exp = gulu.Str.RemoveInvisible(exp)
|
||||
exp = regexp.QuoteMeta(exp)
|
||||
|
||||
fieldFilter := fieldRegexp(exp)
|
||||
stmt := "SELECT * FROM `blocks` WHERE (" + fieldFilter + ") AND type IN " + typeFilter
|
||||
|
|
@ -563,16 +564,16 @@ func fullTextSearchByRegexp(exp, box, path, typeFilter string, beforeLen int) (r
|
|||
return
|
||||
}
|
||||
|
||||
func fullTextSearchCountByRegexp(exp, box, path, filter string) (matchedBlockCount, matchedRootCount int) {
|
||||
func fullTextSearchCountByRegexp(exp, box, path, typeFilter string) (matchedBlockCount, matchedRootCount int) {
|
||||
fieldFilter := fieldRegexp(exp)
|
||||
stmt := "SELECT COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` FROM `blocks` WHERE " + fieldFilter + " AND type IN " + filter
|
||||
stmt := "SELECT COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` FROM `blocks` WHERE " + fieldFilter + " AND type IN " + typeFilter
|
||||
if "" != box {
|
||||
stmt += " AND box = '" + box + "'"
|
||||
}
|
||||
if "" != path {
|
||||
stmt += " AND path LIKE '" + path + "%'"
|
||||
}
|
||||
stmt += " ORDER BY sort ASC LIMIT " + strconv.Itoa(Conf.Search.Limit)
|
||||
stmt += " LIMIT " + strconv.Itoa(Conf.Search.Limit)
|
||||
result, _ := sql.Query(stmt)
|
||||
if 1 > len(result) {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue