mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-05 16:28:49 +01:00
🎨 Global search supports pagination to display results https://github.com/siyuan-note/siyuan/issues/7948
This commit is contained in:
parent
f34123c1ad
commit
c5c24994a8
2 changed files with 3 additions and 3 deletions
|
|
@ -397,7 +397,7 @@ const pageSize = 32
|
|||
// method:0:关键字,1:查询语法,2:SQL,3:正则表达式
|
||||
// orderBy: 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时),6:按相关度升序,7:按相关度降序
|
||||
// groupBy:0:不分组,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: // 不分组
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue