Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b3f99e

Browse files
committed
搜索bugfix
1 parent 50f0af1 commit 9b3f99e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

websites/code2/studygolang/src/http/controller/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (SearchController) Search(ctx echo.Context) error {
2929
"q": q,
3030
"f": field,
3131
}
32-
if err == nil && respBody != nil {
32+
if err == nil {
3333
uri := "/search?q=" + q + "&f=" + field
3434
paginator := logic.NewPaginatorWithPerPage(p, rows)
3535
data["pageHtml"] = paginator.SetTotal(int64(respBody.NumFound)).GetPageHtml(uri)

websites/code2/studygolang/src/logic/searcher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ func (self SearcherLogic) DoSearch(q, field string, start, rows int) (*model.Res
295295
}
296296
}
297297

298+
if searchResponse.RespBody == nil {
299+
searchResponse.RespBody = &model.ResponseBody{}
300+
}
301+
298302
return searchResponse.RespBody, nil
299303
}
300304

0 commit comments

Comments
 (0)