mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-12-21 11:13:57 +08:00
fix:优化搜索
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/lifei6671/mindoc/models"
|
||||
"github.com/lifei6671/mindoc/utils"
|
||||
"github.com/lifei6671/mindoc/utils/pagination"
|
||||
"github.com/lifei6671/mindoc/utils/sqltil"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@@ -36,7 +37,7 @@ func (c *SearchController) Index() {
|
||||
if c.Member != nil {
|
||||
memberId = c.Member.MemberId
|
||||
}
|
||||
searchResult, totalCount, err := models.NewDocumentSearchResult().FindToPager(keyword, pageIndex, conf.PageSize, memberId)
|
||||
searchResult, totalCount, err := models.NewDocumentSearchResult().FindToPager(sqltil.EscapeLike(keyword), pageIndex, conf.PageSize, memberId)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
@@ -86,6 +87,7 @@ func (c *SearchController) User() {
|
||||
if key == "" || keyword == "" {
|
||||
c.JsonResult(404, "参数错误")
|
||||
}
|
||||
keyword = sqltil.EscapeLike(keyword)
|
||||
|
||||
book, err := models.NewBookResult().FindByIdentify(key, c.Member.MemberId)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user