🎨 Global search supports pagination to display results https://github.com/siyuan-note/siyuan/issues/7948

This commit is contained in:
Liang Ding 2023-04-21 10:03:05 +08:00
parent f34123c1ad
commit c5c24994a8
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 3 additions and 3 deletions

View file

@ -397,7 +397,7 @@ const pageSize = 32
// method0关键字1查询语法2SQL3正则表达式
// orderBy: 0按块类型默认1按创建时间升序2按创建时间降序3按更新时间升序4按更新时间降序5按内容顺序仅在按文档分组时6按相关度升序7按相关度降序
// groupBy0不分组1按文档分组
func FullTextSearchBlock(query string, boxes, paths []string, types map[string]bool, method, orderBy, groupBy, page int) (ret []*Block, matchedBlockCount, matchedRootCount, pageCount, totalCount int) {
func FullTextSearchBlock(query string, boxes, paths []string, types map[string]bool, method, orderBy, groupBy, page int) (ret []*Block, matchedBlockCount, matchedRootCount, pageCount int) {
query = strings.TrimSpace(query)
beforeLen := 36
var blocks []*Block
@ -421,6 +421,7 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b
pathFilter := buildPathsFilter(paths)
blocks, matchedBlockCount, matchedRootCount = fullTextSearchByKeyword(query, boxFilter, pathFilter, filter, orderByClause, beforeLen, page)
}
pageCount = (matchedBlockCount + pageSize - 1) / pageSize
switch groupBy {
case 0: // 不分组