wangshan před 3 roky
rodič
revize
ea689522be

+ 8 - 2
jyBXCore/rpc/internal/logic/getsearchlistlogic.go

@@ -92,10 +92,15 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 		}
 		//无限制
 		if res.IsLimit == 1 {
+			//分词后 第二页数据请求 先获取全部数据 再切割
+			if in.SplitKeywords != "" && strings.Contains(in.SplitKeywords, "+&&&") && in.PageNum == 2 {
+				in.KeyWords = strings.ReplaceAll(in.KeyWords, "+&&&", "")
+				in.PageNum = 1
+			}
 			count, list := util.GetBidSearchData(in)
 			res.KeyWords = in.KeyWords
 			//二次搜索- 一次搜索结果少于一页数据;关键词长度大于三;第一,二页请求;搜索范围包括title;四个条件
-			if len([]rune(in.KeyWords)) > 3 && int(count) < util.SearchPageSize && int(count) > -1 && in.PageNum < 3 && strings.Contains(in.SelectType, "title") {
+			if len([]rune(in.KeyWords)) > 3 && int(count) < util.SearchPageSize && 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
@@ -125,7 +130,8 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 						karr = append(karr, v)
 						kbool[v] = true
 					}
-					res.KeyWords = strings.Join(karr, "+")
+					//+&&& 作为二次搜索第二页数据请求的标识(临时处理)
+					res.KeyWords = strings.Join(karr, "+") + "+&&&"
 				}
 			}
 			limitCount := MC.If(in.UserType != "fType", int64(util.SearchPageSize*util.SearchMaxPageNum_PAYED), int64(util.SearchPageSize*util.SearchMaxPageNum)).(int64)

+ 1 - 3
jyBXCore/rpc/util/search.go

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