mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 Global search supports pagination to display results https://github.com/siyuan-note/siyuan/issues/7948
This commit is contained in:
parent
0a489606e3
commit
685b7e1383
2 changed files with 25 additions and 14 deletions
|
|
@ -218,6 +218,14 @@ func fullTextSearchBlock(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
page := 1
|
||||
if nil != arg["page"] {
|
||||
page = int(arg["page"].(float64))
|
||||
}
|
||||
if 0 >= page {
|
||||
page = 1
|
||||
}
|
||||
|
||||
query := arg["query"].(string)
|
||||
pathsArg := arg["paths"]
|
||||
var paths, boxes []string
|
||||
|
|
@ -259,10 +267,12 @@ func fullTextSearchBlock(c *gin.Context) {
|
|||
if nil != groupByArg {
|
||||
groupBy = int(groupByArg.(float64))
|
||||
}
|
||||
blocks, matchedBlockCount, matchedRootCount := model.FullTextSearchBlock(query, boxes, paths, types, method, orderBy, groupBy)
|
||||
blocks, matchedBlockCount, matchedRootCount, pageCount, totalCount := model.FullTextSearchBlock(query, boxes, paths, types, method, orderBy, groupBy, page)
|
||||
ret.Data = map[string]interface{}{
|
||||
"blocks": blocks,
|
||||
"matchedBlockCount": matchedBlockCount,
|
||||
"matchedRootCount": matchedRootCount,
|
||||
"pageCount": pageCount,
|
||||
"totalCount": totalCount,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue