|
@@ -61,7 +61,7 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
|
multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
|
|
|
query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
|
|
|
query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
|
|
|
- query_bools_must := `{"bool":{"must":[{"range":{"bidamount":{%s}}}],"must_not":[{"term":{"bidamount":0}},{"term":{"budget":0}}]}},{"bool":{"must":[{"term":{"bidamount":0}},{"range":{"budget":{%s}}}]}},{"bool":{"must":[{"term":{"budget":0}},{"range":{"bidamount":{%s}}}]}}`
|
|
|
+ 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}}`
|
|
|
gte := `"gte": %s`
|
|
@@ -185,7 +185,7 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
|
if _maxPrice != "" {
|
|
|
sq += fmt.Sprintf(lte, _maxPrice)
|
|
|
}
|
|
|
- query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_bools_must, sq, sq, sq))
|
|
|
+ query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_price, sq, sq))
|
|
|
musts = append(musts, query_price)
|
|
|
}
|
|
|
boolsNum := 0
|
|
@@ -273,9 +273,6 @@ func getSqlObjFromId(_id string) *SieveCondition {
|
|
|
|
|
|
//数据导出-查询结果数量
|
|
|
func GetDataExportSearchCountUseId(_id string) (count int) {
|
|
|
- defer func(t time.Time) {
|
|
|
- fmt.Println("do Cost: ", time.Since(t).Seconds())
|
|
|
- }(time.Now())
|
|
|
scd := getSqlObjFromId(_id)
|
|
|
qstr := getDataExportSql(scd)
|
|
|
log.Printf("GetDataExportSearchCountUseId-%s-count:%d-sql:%s\n", _id, count, qstr)
|
|
@@ -669,7 +666,6 @@ 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("sql----", sql)
|
|
|
return elastic.Get(INDEX, TYPE, sql)
|
|
|
}
|
|
|
|
|
@@ -709,7 +705,6 @@ func ScreenData(arr *[]map[string]interface{}, dataType string, resultNum int, k
|
|
|
if emptyNum == -1 {
|
|
|
continue
|
|
|
}
|
|
|
- // log.Println(util.ObjToString(v["title"]), "----", kws[0].Keyword)
|
|
|
if len(kws) > 0 && kws[0].Keyword != "" {
|
|
|
var kwsFlag = true
|
|
|
for _, vk := range kws {
|