🎨 Replace All is no longer affected by pagination https://github.com/siyuan-note/siyuan/issues/8265

This commit is contained in:
Daniel 2023-06-29 18:14:36 +08:00
parent fa8e910bed
commit c49ac8990c
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 32 additions and 23 deletions

View file

@ -35,7 +35,7 @@ func findReplace(c *gin.Context) {
return
}
_, _, paths, boxes, types, method, orderBy, groupBy := parseSearchArgs(arg)
_, _, _, paths, boxes, types, method, orderBy, groupBy := parseSearchArgs(arg)
k := arg["k"].(string)
r := arg["r"].(string)
@ -215,8 +215,8 @@ func fullTextSearchBlock(c *gin.Context) {
return
}
page, query, paths, boxes, types, method, orderBy, groupBy := parseSearchArgs(arg)
blocks, matchedBlockCount, matchedRootCount, pageCount := model.FullTextSearchBlock(query, boxes, paths, types, method, orderBy, groupBy, page)
page, pageSize, query, paths, boxes, types, method, orderBy, groupBy := parseSearchArgs(arg)
blocks, matchedBlockCount, matchedRootCount, pageCount := model.FullTextSearchBlock(query, boxes, paths, types, method, orderBy, groupBy, page, pageSize)
ret.Data = map[string]interface{}{
"blocks": blocks,
"matchedBlockCount": matchedBlockCount,
@ -225,7 +225,7 @@ func fullTextSearchBlock(c *gin.Context) {
}
}
func parseSearchArgs(arg map[string]interface{}) (page int, query string, paths, boxes []string, types map[string]bool, method, orderBy, groupBy int) {
func parseSearchArgs(arg map[string]interface{}) (page, pageSize int, query string, paths, boxes []string, types map[string]bool, method, orderBy, groupBy int) {
page = 1
if nil != arg["page"] {
page = int(arg["page"].(float64))
@ -234,6 +234,14 @@ func parseSearchArgs(arg map[string]interface{}) (page int, query string, paths,
page = 1
}
pageSize = 32
if nil != arg["pageSize"] {
pageSize = int(arg["pageSize"].(float64))
}
if 0 >= pageSize {
pageSize = 32
}
queryArg := arg["query"]
if nil != queryArg {
query = queryArg.(string)