🎨 Improve search ignore result count https://github.com/siyuan-note/siyuan/issues/12662
This commit is contained in:
parent
f9a4dcf2a1
commit
dd1bc54cac
4 changed files with 15 additions and 6 deletions
2
app/stage/protyle/js/lute/lute.min.js
vendored
2
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -10,7 +10,7 @@ require (
|
|||
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
|
||||
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
|
||||
github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02
|
||||
github.com/88250/lute v1.7.7-0.20240929140516-3e8e6c2366d8
|
||||
github.com/88250/lute v1.7.7-0.20240930090541-cf9ad3552938
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
|
||||
|
|
|
@ -14,10 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
|
|||
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02 h1:3e5+yobj655pTeKOYMbJrnc1mE51ZkbXIxquTYZuYCY=
|
||||
github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
|
||||
github.com/88250/lute v1.7.7-0.20240929014232-4aefefe54695 h1:Lka2ckqIllp+uIAaM2HphTaB+af9Vi1ctdrghyvsg6U=
|
||||
github.com/88250/lute v1.7.7-0.20240929014232-4aefefe54695/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
||||
github.com/88250/lute v1.7.7-0.20240929140516-3e8e6c2366d8 h1:H4xW2ISiAaRm5SPjZD30JU6h9nUTlMGMGe0TjU2T3Rs=
|
||||
github.com/88250/lute v1.7.7-0.20240929140516-3e8e6c2366d8/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
||||
github.com/88250/lute v1.7.7-0.20240930090541-cf9ad3552938 h1:xeEHN5MTXclggLQQ1hVLEXw1t8TSpejShrCXjkrLwcU=
|
||||
github.com/88250/lute v1.7.7-0.20240930090541-cf9ad3552938/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||
|
|
|
@ -1419,6 +1419,17 @@ func fullTextSearchCount(query, boxFilter, pathFilter, typeFilter string) (match
|
|||
stmt := "SELECT COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` FROM `" + table + "` WHERE (`" + table + "` MATCH '" + columnFilter() + ":(" + query + ")'"
|
||||
stmt += ") AND type IN " + typeFilter
|
||||
stmt += boxFilter + pathFilter
|
||||
|
||||
if ignoreLines := getSearchIgnoreLines(); 0 < len(ignoreLines) {
|
||||
// Support ignore search results https://github.com/siyuan-note/siyuan/issues/10089
|
||||
buf := bytes.Buffer{}
|
||||
for _, line := range ignoreLines {
|
||||
buf.WriteString(" AND ")
|
||||
buf.WriteString(line)
|
||||
}
|
||||
stmt += buf.String()
|
||||
}
|
||||
|
||||
result, _ := sql.QueryNoLimit(stmt)
|
||||
if 1 > len(result) {
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue