|
@@ -132,20 +132,10 @@ const (
|
|
|
//查询采购单位列表
|
|
|
func GetBuyerList(qstr string, in *bxbuyer.BuyerListReq, isCache bool) (resp *bxbuyer.BuyerListResp) {
|
|
|
t1 := time.Now()
|
|
|
- aggs, count := GetAggs(P_INDEX, P_TYPE, qstr)
|
|
|
- log.Println("=------===", count)
|
|
|
- if count > IC.C.BuyerCount {
|
|
|
- count = IC.C.BuyerCount
|
|
|
- }
|
|
|
- if isCache {
|
|
|
- if count > int64(len(IC.C.DefaultBuyerNames)) {
|
|
|
- count = int64(len(IC.C.DefaultBuyerNames))
|
|
|
- }
|
|
|
- }
|
|
|
+ aggs := GetAggs(P_INDEX, P_TYPE, qstr)
|
|
|
resp = &bxbuyer.BuyerListResp{
|
|
|
Data: &bxbuyer.BuyerData{},
|
|
|
}
|
|
|
- resp.Data.Count = count
|
|
|
type GroupStruct struct {
|
|
|
Buckets []struct {
|
|
|
Key string `json:"key,omitempty"`
|
|
@@ -178,6 +168,8 @@ func GetBuyerList(qstr string, in *bxbuyer.BuyerListReq, isCache bool) (resp *bx
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ resp.Data.Count = int64(len(resp.Data.List))
|
|
|
+ log.Println("=---count---===", resp.Data.Count)
|
|
|
if len(resp.Data.List) > 0 {
|
|
|
var wg sync.WaitGroup
|
|
|
//省份和城市 是否查询已关注信息 是否查询已领取信息
|
|
@@ -225,8 +217,8 @@ func GetBuyerList(qstr string, in *bxbuyer.BuyerListReq, isCache bool) (resp *bx
|
|
|
}
|
|
|
|
|
|
//聚合查询
|
|
|
-func GetAggs(index, itype, query string) (aggs map[string]*json.RawMessage, count int64) {
|
|
|
- count = elastic.Count(index, itype, query)
|
|
|
+func GetAggs(index, itype, query string) (aggs map[string]*json.RawMessage) {
|
|
|
+ //count = elastic.Count(index, itype, query)
|
|
|
defer MC.Catch()
|
|
|
client := elastic.GetEsConn()
|
|
|
defer func() {
|