|
@@ -5,7 +5,6 @@ import (
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
- "go.mongodb.org/mongo-driver/bson"
|
|
|
"log"
|
|
|
"math"
|
|
|
mg "mongodb"
|
|
@@ -29,24 +28,26 @@ type KeyWord struct {
|
|
|
|
|
|
/*筛选条件*/
|
|
|
type SieveCondition struct {
|
|
|
- Id string `json:"id"`
|
|
|
- PublishTime string `json:"publishtime"` //发布时间
|
|
|
- Area []string `json:"area"` //地区-省份
|
|
|
- City []string `json:"city"` //地区-城市
|
|
|
- Region []string `json:"region"` //地区-省份+城市
|
|
|
- Industry []string `json:"industry"` //行业
|
|
|
- Keyword []KeyWord `json:"keywords"` //关键词
|
|
|
- Buyer []string `json:"buyer"` //招标单位(采购单位)
|
|
|
- Buyerclass []string `json:"buyerclass"` //采购单位类型
|
|
|
- Winner []string `json:"winner"` //中标单位
|
|
|
- ComeInTime int64 `json:"comeintime"` //入库时间(秒)
|
|
|
- OpenId string `json:"openid"` //用户openid
|
|
|
- MinPrice string `json:"minprice"` //金额——最少
|
|
|
- MaxPrice string `json:"maxprice"` //金额——最多
|
|
|
- SelectType string `json:"selectType"` //筛选(正文 or 标题)
|
|
|
- Subtype string `json:"subtype"` //信息类型
|
|
|
- Comeinfrom string `json:"comeinfrom"` //查询来源
|
|
|
- DisWord string `json:"disWord"` //分销系统 口令
|
|
|
+ Id string `json:"id"`
|
|
|
+ PublishTime string `json:"publishtime"` //发布时间
|
|
|
+ Area []string `json:"area"` //地区-省份
|
|
|
+ City []string `json:"city"` //地区-城市
|
|
|
+ Region []string `json:"region"` //地区-省份+城市
|
|
|
+ Industry []string `json:"industry"` //行业
|
|
|
+ Keyword []KeyWord `json:"keywords"` //关键词
|
|
|
+ Buyer []string `json:"buyer"` //招标单位(采购单位)
|
|
|
+ Buyerclass []string `json:"buyerclass"` //采购单位类型
|
|
|
+ HasBuyerTel string `json:"hasBuyertel"` //是否有采购单位电话
|
|
|
+ Winner []string `json:"winner"` //中标单位
|
|
|
+ HasWinnerTel string `json:"hasWinnertel"` //是否有中标单位电话
|
|
|
+ ComeInTime int64 `json:"comeintime"` //入库时间(秒)
|
|
|
+ OpenId string `json:"openid"` //用户openid
|
|
|
+ MinPrice string `json:"minprice"` //金额——最少
|
|
|
+ MaxPrice string `json:"maxprice"` //金额——最多
|
|
|
+ SelectType string `json:"selectType"` //筛选(正文 or 标题)
|
|
|
+ Subtype string `json:"subtype"` //信息类型
|
|
|
+ SelectIds []string `json:"selectId"` //选择信息导出
|
|
|
+ Comeinfrom string `json:"comeinfrom"` //查询来源
|
|
|
}
|
|
|
|
|
|
const (
|
|
@@ -63,17 +64,24 @@ var searchPool = make(chan bool, 8)
|
|
|
|
|
|
//获取数据导出查询语句
|
|
|
func getDataExportSql(scd *SieveCondition) string {
|
|
|
+ if len(scd.SelectIds) > 0 {
|
|
|
+ query := `{"query":{"bool":{"must":[%s]}}}`
|
|
|
+ doSearchSql := fmt.Sprintf(`{"terms":{"_id":[%s]}}`, `"`+strings.Join(scd.SelectIds, `","`)+`"`)
|
|
|
+ return fmt.Sprintf(query, doSearchSql)
|
|
|
+ }
|
|
|
multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
|
|
|
- query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
|
|
|
+ query := `{"query":{"bool":{"must":[%s],"must_not":[%s],"should":[%s],"minimum_should_match": %d}}}`
|
|
|
query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
|
|
|
query_price := `{"bool":{"must":[{"range":{"bidamount":{%s}}}]}},{"bool":{"must":[{"range":{"budget":{%s}}}],"must_not":[{"range":{"bidamount":{"gte":-1}}}]}}`
|
|
|
query_bool_must := `{"terms":{"%s":[%s]}}`
|
|
|
query_bool_must_and := `{"bool":{"must":[%s]%s}}`
|
|
|
+ query_missing := `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
|
|
|
gte := `"gte": %s`
|
|
|
lte := `"lte": %s`
|
|
|
|
|
|
bools := []string{}
|
|
|
musts := []string{fmt.Sprintf(`{"range":{"comeintime":{"lt":%d}}}`, scd.ComeInTime)}
|
|
|
+ must_not := []string{}
|
|
|
//省份
|
|
|
areaCity := []string{}
|
|
|
if len(scd.Area) > 0 {
|
|
@@ -247,7 +255,21 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
|
|
|
+ if scd.HasBuyerTel != "" {
|
|
|
+ if scd.HasBuyerTel == "y" {
|
|
|
+ must_not = append(must_not, fmt.Sprintf(query_missing, "buyertel"))
|
|
|
+ } else {
|
|
|
+ musts = append(musts, fmt.Sprintf(query_missing, "buyertel"))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if scd.HasWinnerTel != "" {
|
|
|
+ if scd.HasWinnerTel == "y" {
|
|
|
+ must_not = append(must_not, fmt.Sprintf(query_missing, "winnertel"))
|
|
|
+ } else {
|
|
|
+ musts = append(musts, fmt.Sprintf(query_missing, "winnertel"))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","), strings.Join(bools, ","), boolsNum)
|
|
|
return qstr
|
|
|
}
|
|
|
|
|
@@ -261,27 +283,33 @@ func GetSqlObjFromId(mongo mg.MongodbSim, _id string) *SieveCondition {
|
|
|
return nil
|
|
|
}
|
|
|
return &SieveCondition{
|
|
|
- Id: _id,
|
|
|
- Keyword: getKeyWordArrFromDbResult((*query)["keywords"]),
|
|
|
- Industry: getStringArrFromDbResult((*query)["industry"]),
|
|
|
- MinPrice: qutil.ObjToString((*query)["minprice"]),
|
|
|
- MaxPrice: qutil.ObjToString((*query)["maxprice"]),
|
|
|
- Subtype: qutil.ObjToString((*query)["subtype"]),
|
|
|
- Area: getStringArrFromDbResult((*query)["area"]),
|
|
|
- City: getStringArrFromDbResult((*query)["city"]),
|
|
|
- SelectType: qutil.ObjToString((*query)["selectType"]),
|
|
|
- PublishTime: qutil.ObjToString((*query)["publishtime"]),
|
|
|
- Buyer: getStringArrFromDbResult((*query)["buyer"]),
|
|
|
- Buyerclass: getStringArrFromDbResult((*query)["buyerclass"]),
|
|
|
- Winner: getStringArrFromDbResult((*query)["winner"]),
|
|
|
- ComeInTime: qutil.Int64All((*query)["comeintime"]),
|
|
|
- Comeinfrom: qutil.ObjToString((*query)["comeinfrom"]),
|
|
|
+ Id: _id,
|
|
|
+ Keyword: getKeyWordArrFromDbResult((*query)["keywords"]),
|
|
|
+ Industry: getStringArrFromDbResult((*query)["industry"]),
|
|
|
+ MinPrice: qutil.ObjToString((*query)["minprice"]),
|
|
|
+ MaxPrice: qutil.ObjToString((*query)["maxprice"]),
|
|
|
+ Subtype: qutil.ObjToString((*query)["subtype"]),
|
|
|
+ Area: getStringArrFromDbResult((*query)["area"]),
|
|
|
+ City: getStringArrFromDbResult((*query)["city"]),
|
|
|
+ SelectType: qutil.ObjToString((*query)["selectType"]),
|
|
|
+ PublishTime: qutil.ObjToString((*query)["publishtime"]),
|
|
|
+ Buyer: getStringArrFromDbResult((*query)["buyer"]),
|
|
|
+ Buyerclass: getStringArrFromDbResult((*query)["buyerclass"]),
|
|
|
+ HasBuyerTel: qutil.ObjToString((*query)["hasBuyertel"]),
|
|
|
+ Winner: getStringArrFromDbResult((*query)["winner"]),
|
|
|
+ HasWinnerTel: qutil.ObjToString((*query)["hasWinnertel"]),
|
|
|
+ ComeInTime: qutil.Int64All((*query)["comeintime"]),
|
|
|
+ Comeinfrom: qutil.ObjToString((*query)["comeinfrom"]),
|
|
|
+ SelectIds: getStringArrFromDbResult((*query)["selectIds"]),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//数据导出-查询结果数量
|
|
|
func GetDataExportSearchCountByScdId(sim mg.MongodbSim, elasticAddress, id string) (count int) {
|
|
|
scd := GetSqlObjFromId(sim, id) //用户筛选条件
|
|
|
+ if scd.SelectIds != nil {
|
|
|
+ return len(scd.SelectIds)
|
|
|
+ }
|
|
|
return GetDataExportSearchCountBySieveCondition(scd, elasticAddress)
|
|
|
}
|
|
|
|
|
@@ -356,28 +384,62 @@ func isNullSearch(scd *SieveCondition) (isNull bool) {
|
|
|
* webdomain 三级页域名
|
|
|
* count 返回数量 (-1:预览数据查询)
|
|
|
*/
|
|
|
-var EntTable = "winner_enterprise"
|
|
|
|
|
|
-func GetDataExportSearchResultByScdId(sim, entmg mg.MongodbSim, elasticAddress, id string, dataType string, checkCount int, webdomain string) (*[]map[string]interface{}, error) {
|
|
|
+func GetDataExportSearchResultByScdId(sim mg.MongodbSim, elasticAddress, id, dataType string, checkCount int) (*[]map[string]interface{}, error) {
|
|
|
scd := GetSqlObjFromId(sim, id)
|
|
|
- return GetDataExportSearchResult(entmg, elasticAddress, scd, dataType, checkCount, webdomain)
|
|
|
+ //if scd.SelectIds != nil {
|
|
|
+ // return GetDataExportSelectResult(scd, dataType, checkCount)
|
|
|
+ //}
|
|
|
+ return GetDataExportSearchResult(elasticAddress, scd, dataType, checkCount)
|
|
|
}
|
|
|
|
|
|
//GetDataExportSearchResult 获取数据导出内容
|
|
|
//entmg 高级字段包查询企业电话邮箱等字段
|
|
|
//checkCount -1 预览500条
|
|
|
-func GetDataExportSearchResult(entmg mg.MongodbSim, elasticAddress string, scd *SieveCondition, dataType string, checkCount int, webdomain string) (*[]map[string]interface{}, error) {
|
|
|
+func GetDataExportSearchResult(elasticAddress string, scd *SieveCondition, dataType string, checkCount int) (*[]map[string]interface{}, error) {
|
|
|
defer qutil.Catch()
|
|
|
- var res []map[string]interface{}
|
|
|
- //获取查询语句
|
|
|
if scd == nil {
|
|
|
return nil, errors.New("GetDataExportSearchResult-获取查询条件")
|
|
|
}
|
|
|
+ //获取查询语句
|
|
|
qstr := getDataExportSql(scd)
|
|
|
log.Printf("GetDataExportSearchResult-%s-sql:%s\n", scd.Id, qstr)
|
|
|
+ log.Println("len(scd.SelectIds)=", len(scd.SelectIds))
|
|
|
//数据导出数据查询
|
|
|
- if checkCount > onceSearchCount { //分批次查询
|
|
|
- batchNum := qutil.IntAll(math.Ceil(float64(checkCount) / float64(onceSearchCount)))
|
|
|
+ res := doSearchByBatch(qstr, dataType, checkCount, fmt.Sprintf("%s-%s", "GetDataExportSearchResult", scd.Id))
|
|
|
+ //超级搜索一致的检索(防止数据导出和超级搜索数据量不一致)
|
|
|
+ if scd.Comeinfrom == "supersearchPage" && (len(scd.Keyword) != 0 || len(scd.Industry) != 0) && len(scd.SelectIds) == 0 {
|
|
|
+ if len(scd.Keyword) != 0 {
|
|
|
+ num := len(res)
|
|
|
+ searchTextSize := 0
|
|
|
+ if len(scd.Keyword) > 0 {
|
|
|
+ searchTextSize = len([]rune(scd.Keyword[0].Keyword))
|
|
|
+ }
|
|
|
+ if searchTextSize > 3 && num < 50 {
|
|
|
+ secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress)
|
|
|
+ scd.Keyword[0].Keyword = secondKWS
|
|
|
+ scd.SelectType = "title"
|
|
|
+ qstr = getDataExportSql(scd)
|
|
|
+ log.Printf("GetDataExportSearchResult-%s-分词查询-sql:%s\n", scd.Id, qstr)
|
|
|
+ res2 := doSearch(qstr, 0, 100, "")
|
|
|
+ res = *delRepeatMapArr(&res, res2)
|
|
|
+ if len(res) > 100 {
|
|
|
+ res = res[:100]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //校验数量
|
|
|
+ if checkCount != len(res) && checkCount != -1 {
|
|
|
+ return nil, fmt.Errorf("GetDataExportSearchResult-%s-数据总量校验异常,期望:%d,实际:%d", scd.Id, checkCount, len(res))
|
|
|
+ //发邮件
|
|
|
+ }
|
|
|
+ return &res, nil
|
|
|
+}
|
|
|
+
|
|
|
+func doSearchByBatch(query, dataType string, searchCount int, flag string) (res []map[string]interface{}) {
|
|
|
+ if searchCount > onceSearchCount { //分批次查询
|
|
|
+ batchNum := qutil.IntAll(math.Ceil(float64(searchCount) / float64(onceSearchCount)))
|
|
|
var searchWaitGroup = &sync.WaitGroup{}
|
|
|
var lock sync.Mutex
|
|
|
for n := 0; n < batchNum; n++ {
|
|
@@ -390,27 +452,27 @@ func GetDataExportSearchResult(entmg mg.MongodbSim, elasticAddress string, scd *
|
|
|
}()
|
|
|
checkNum, checkOk := onceSearchCount, false
|
|
|
if start == (batchNum - 1) {
|
|
|
- if checkCount%onceSearchCount != 0 {
|
|
|
- checkNum = checkCount % onceSearchCount
|
|
|
+ if searchCount%onceSearchCount != 0 {
|
|
|
+ checkNum = searchCount % onceSearchCount
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var tmp *[]map[string]interface{}
|
|
|
for i := 0; i < 3; i++ {
|
|
|
- tmp = doSearch(qstr, start*onceSearchCount, onceSearchCount, dataType)
|
|
|
+ tmp = doSearch(query, start*onceSearchCount, onceSearchCount, dataType)
|
|
|
if tmp != nil && (len(*tmp) == checkNum) { //校验数据量是否够
|
|
|
checkOk = true
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
if tmp == nil {
|
|
|
- log.Printf("GetDataExportSearchResult-%s-第%d页数据查询结果为空\n", scd.Id, start+1)
|
|
|
+ log.Printf("%s-第%d页数据查询结果为空\n", flag, start+1)
|
|
|
return
|
|
|
}
|
|
|
if checkOk {
|
|
|
- log.Printf("GetDataExportSearchResult-%s-第%d页数据加载完成,共%d条\n", scd.Id, start+1, len(*tmp))
|
|
|
+ log.Printf("%s-第%d页数据加载完成,共%d条\n", flag, start+1, len(*tmp))
|
|
|
} else {
|
|
|
- log.Printf("GetDataExportSearchResult-%s-第%d页数据加载异常,共%d条,预期%d条\n", scd.Id, start+1, len(*tmp), checkNum)
|
|
|
+ log.Printf("%s-第%d页数据加载异常,共%d条,预期%d条\n", flag, start+1, len(*tmp), checkNum)
|
|
|
}
|
|
|
lock.Lock()
|
|
|
res = append(res, *tmp...)
|
|
@@ -418,101 +480,22 @@ func GetDataExportSearchResult(entmg mg.MongodbSim, elasticAddress string, scd *
|
|
|
}(n)
|
|
|
}
|
|
|
searchWaitGroup.Wait()
|
|
|
- log.Printf("GetDataExportSearchResult-%s-分批次加载数据总量为%d\n", scd.Id, len(res))
|
|
|
+ log.Printf("%s-分批次加载数据总量为%d\n", flag, len(res))
|
|
|
} else {
|
|
|
- queryCount := qutil.If(checkCount == -1, 500, checkCount).(int)
|
|
|
- tmp := doSearch(qstr, 0, queryCount, dataType)
|
|
|
+ queryCount := qutil.If(searchCount == -1, onceSearchCount, searchCount).(int)
|
|
|
+ searchPool <- true
|
|
|
+ tmp := doSearch(query, 0, queryCount, dataType)
|
|
|
+ <-searchPool
|
|
|
if tmp == nil || len(*tmp) == 0 {
|
|
|
- log.Printf("GetDataExportSearchResult-%s-一次性加载数据异常\n", scd.Id)
|
|
|
+ log.Printf("%s-一次性加载数据异常\n", flag)
|
|
|
} else {
|
|
|
res = *tmp
|
|
|
- log.Printf("GetDataExportSearchResult-%s-一次性加载数据总量为%d\n", scd.Id, len(res))
|
|
|
- }
|
|
|
- }
|
|
|
- //超级搜索一致的检索(防止数据导出和超级搜索数据量不一致)
|
|
|
- if scd.Comeinfrom == "supersearchPage" && (len(scd.Keyword) != 0 || len(scd.Industry) != 0) {
|
|
|
- if len(scd.Keyword) != 0 {
|
|
|
- num := len(res)
|
|
|
- searchTextSize := 0
|
|
|
- if len(scd.Keyword) > 0 {
|
|
|
- searchTextSize = len([]rune(scd.Keyword[0].Keyword))
|
|
|
- }
|
|
|
- if searchTextSize > 3 && num < 50 {
|
|
|
- secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress)
|
|
|
- scd.Keyword[0].Keyword = secondKWS
|
|
|
- scd.SelectType = "title"
|
|
|
- qstr = getDataExportSql(scd)
|
|
|
- log.Printf("GetDataExportSearchResult-%s-分词查询-sql:%s\n", scd.Id, qstr)
|
|
|
- res2 := doSearch(qstr, 0, 100, "")
|
|
|
- res = *delRepeatMapArr(&res, res2)
|
|
|
- if len(res) > 100 {
|
|
|
- res = res[:100]
|
|
|
- }
|
|
|
- }
|
|
|
+ log.Printf("%s-一次性加载数据总量为%d\n", flag, len(res))
|
|
|
}
|
|
|
}
|
|
|
- //校验数量
|
|
|
- if checkCount != len(res) && checkCount != -1 {
|
|
|
- return nil, fmt.Errorf("GetDataExportSearchResult-%s-数据总量校验异常,期望:%d,实际:%d", scd.Id, checkCount, len(res))
|
|
|
- //发邮件
|
|
|
- }
|
|
|
- res = *FormatExportData(entmg, &res, webdomain, dataType)
|
|
|
- return &res, nil
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
-//数据导出预览
|
|
|
-//func GetDataExportSearchResultPreview(sim mg.MongodbSim, elasticAddress string, _id, dataType string) (*[]map[string]interface{}, []KeyWord) {
|
|
|
-// defer qutil.Catch()
|
|
|
-// var res []map[string]interface{}
|
|
|
-// var kws []KeyWord
|
|
|
-// scd := GetSqlObjFromId(sim, _id)
|
|
|
-// //获取查询语句
|
|
|
-// qstr := getDataExportSql(scd)
|
|
|
-// log.Printf("GetDataExportSearchResultUseId-%s-sql:%s\n", scd.Id, qstr)
|
|
|
-// kws = scd.Keyword
|
|
|
-// //数据预览数据查询
|
|
|
-// if scd.Comeinfrom == "supersearchPage" && len(scd.Keyword) == 0 && len(scd.Industry) == 0 {
|
|
|
-// //空查询
|
|
|
-// obj := redis.Get("other", "export_news")
|
|
|
-// if obj != nil {
|
|
|
-// res = qutil.ObjArrToMapArr(obj.([]interface{}))
|
|
|
-// } else {
|
|
|
-// res = *doSearch(qstr, 0, 500, "2")
|
|
|
-// if len(res) > 0 {
|
|
|
-// redis.Put("other", "export_news", res, 7200)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return &res, kws
|
|
|
-// } else if scd.Comeinfrom == "supersearchPage" {
|
|
|
-// //超级搜索非空查询
|
|
|
-// count := int(elastic.Count(INDEX, TYPE, qstr))
|
|
|
-// searchTextSize := 0
|
|
|
-// if len(scd.Keyword) > 0 {
|
|
|
-// searchTextSize = len([]rune(scd.Keyword[0].Keyword))
|
|
|
-// }
|
|
|
-// if searchTextSize > 3 && count < 50 {
|
|
|
-// var res *[]map[string]interface{}
|
|
|
-// if count > 0 {
|
|
|
-// res = doSearch(qstr, 0, count, "")
|
|
|
-// }
|
|
|
-// secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress)
|
|
|
-// scd.Keyword[0].Keyword = secondKWS
|
|
|
-// scd.SelectType = "title"
|
|
|
-// qstr = getDataExportSql(scd)
|
|
|
-// log.Printf("GetDataExportSearchResultUseId-%s-分词-sql:%s\n", scd.Id, qstr)
|
|
|
-// res2 := doSearch(qstr, 0, 100, "")
|
|
|
-// if len(*res2) > 100 {
|
|
|
-// res2_temp := (*res2)[:100]
|
|
|
-// res2 = &res2_temp
|
|
|
-// }
|
|
|
-// return delRepeatMapArr(res, res2), kws
|
|
|
-// }
|
|
|
-// }
|
|
|
-// //非空查询
|
|
|
-// res = *doSearch(qstr, 0, 500, dataType)
|
|
|
-// return &res, kws
|
|
|
-//}
|
|
|
-
|
|
|
func FormatExportData(entmg mg.MongodbSim, data *[]map[string]interface{}, webdomain string, dataType string, encry ...bool) *[]map[string]interface{} {
|
|
|
//格式化输出
|
|
|
isEncry := false
|
|
@@ -525,7 +508,7 @@ func FormatExportData(entmg mg.MongodbSim, data *[]map[string]interface{}, webdo
|
|
|
//查询企业公示 法人 公司电话 公司邮箱地址
|
|
|
s_winner, ok := v["s_winner"].(string) //改为entidlist?
|
|
|
if ok && s_winner != "" {
|
|
|
- if entData, ok := entmg.Find(EntTable, bson.M{"company_name": s_winner}, nil, `{"company_name":1,"company_email":1,"legal_person":1,"company_phone":1}`, false, -1, -1); ok {
|
|
|
+ if entData, ok := entmg.Find("winner_enterprise", map[string]interface{}{"company_name": s_winner}, nil, `{"company_name":1,"company_email":1,"legal_person":1,"company_phone":1}`, false, -1, -1); ok {
|
|
|
if entData != nil && *entData != nil && len(*entData) > 0 {
|
|
|
for _, ev := range *entData {
|
|
|
if v["s_winner"] == ev["company_name"] {
|
|
@@ -683,6 +666,7 @@ func doSearch(sql string, start, count int, dataType string) *[]map[string]inter
|
|
|
//分页排序
|
|
|
sql = sql[:len(sql)-1] + `,"sort": {"publishtime":"desc"},"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(count) + "}"
|
|
|
}
|
|
|
+ log.Println("doSearch", sql)
|
|
|
return elastic.Get(INDEX, TYPE, sql)
|
|
|
}
|
|
|
|
|
@@ -751,7 +735,6 @@ func ScreenData(arr *[]map[string]interface{}, dataType string, resultNum int, k
|
|
|
keys = append(keys, k)
|
|
|
}
|
|
|
sort.Ints(keys)
|
|
|
- log.Println("空字段数量", keys)
|
|
|
//选取结果
|
|
|
for _, v := range keys {
|
|
|
if len(AllMap[v]) >= resultNum {
|