소스 검색

feat:更新

wangshan 3 년 전
부모
커밋
7d800a23d9
2개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      jyBXCore/rpc/internal/logic/getsearchlistlogic.go
  2. 2 0
      jyBXCore/rpc/util/search.go

+ 1 - 1
jyBXCore/rpc/internal/logic/getsearchlistlogic.go

@@ -95,7 +95,7 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 			count, list := util.GetBidSearchData(in)
 			res.KeyWords = in.KeyWords
 			//二次搜索- 一次搜索结果少于一页数据;关键词长度大于三;第一,二页请求;搜索范围包括title;四个条件
-			if len([]rune(in.KeyWords)) > 3 && int(count) < util.SearchPageSize && in.PageNum < 3 && strings.Contains(in.SelectType, "title") {
+			if len([]rune(in.KeyWords)) > 3 && int(count) < util.SearchPageSize && int(count) > -1 && in.PageNum < 3 && strings.Contains(in.SelectType, "title") {
 				if iksk := util.HttpEs(in.KeyWords, "ik_smart", IC.DB.Es.Addr); iksk != "" {
 					iksk_temp := in.KeyWords
 					in.KeyWords = iksk

+ 2 - 0
jyBXCore/rpc/util/search.go

@@ -178,6 +178,8 @@ func GetBidSearchData(in *bxcore.SearchReq) (count int64, list []*bxcore.SearchL
 	//首页
 	if qstr != "" && start == 0 {
 		count = elastic.Count(INDEX, TYPE, qstr)
+	} else {
+		count = -1
 	}
 	if count > 0 || start > 1 {
 		field := bidSearch_field_1