wangchuanjin 7 年 前
コミット
d1f618936f
1 ファイル変更8 行追加8 行削除
  1. 8 8
      jyinfomatch/src/qyfw/loadDatas.go

+ 8 - 8
jyinfomatch/src/qyfw/loadDatas.go

@@ -80,11 +80,11 @@ func initBiddingCache(_id, lastid string, lastTime int64, startTime, endTime int
 		count = MaxSearch
 		log.Println("目前数据多于", MaxSearch, ",只加载了", MaxSearch, "条!")
 	}
-	OnceMax := 400 //ES一次查询这么多条
-	if OnceMax > count {
-		OnceMax = count
+	onceSize := 400 //ES一次查询这么多条
+	if onceSize > count {
+		onceSize = count
 	}
-	totalPage := int((count + OnceMax - 1) / OnceMax)
+	totalPage := int((count + onceSize - 1) / onceSize)
 	log.Println("数据一共", totalPage, "页!")
 	//如果res长度和cout相差5条,重试
 	for t := 1; t <= 3; t++ {
@@ -97,11 +97,11 @@ func initBiddingCache(_id, lastid string, lastTime int64, startTime, endTime int
 					searchWaitGroup.Done()
 					<-searchpool
 				}()
-				size := OnceMax
-				if start == totalPage-1 && count%OnceMax != 0 {
-					size = count % OnceMax
+				size := onceSize
+				if start == totalPage-1 && count%onceSize != 0 {
+					size = count % onceSize
 				}
-				r := elastic.GetAllByNgram(DB, DB, c_query, "", SortQuery, ShowFields, start*OnceMax, size, 0, false)
+				r := elastic.GetAllByNgram(DB, DB, c_query, "", SortQuery, ShowFields, start*onceSize, size, 0, false)
 				res = append(res, *r...)
 				log.Println("第", start+1, "页数据加载完成!")
 			}(i)