|
@@ -91,7 +91,8 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
|
return fmt.Sprintf(query, doSearchSql)
|
|
|
}
|
|
|
multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
|
|
|
- query := `{"query":{"bool":{"must":[%s],"must_not":[%s],"should":[%s],"minimum_should_match": %d}}}`
|
|
|
+ //query := `{"query":{"bool":{"must":[%s],"must_not":[%s],"should":[%s],"minimum_should_match": %d}}}`
|
|
|
+ query := `{"query": {"function_score": {"query": {"bool": {"must": [%s],"must_not": [%s],"should": [%s],"minimum_should_match": %d}},"field_value_factor": {"field": "dataweight","modifier": "ln1p","missing": 0}}}}`
|
|
|
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]}}`
|
|
@@ -918,7 +919,7 @@ func doSearch(sql string, start, count int, dataType string) *[]map[string]inter
|
|
|
sql = sql[:len(sql)-1] + `,"_source":[` + dataexport_field + "]}"
|
|
|
}
|
|
|
//分页排序
|
|
|
- sql = sql[:len(sql)-1] + `,"sort": {"publishtime":"desc","id":"desc"},"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(count) + "}"
|
|
|
+ sql = sql[:len(sql)-1] + `,"sort": {"_score": "desc","publishtime":"desc","id":"desc"},"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(count) + "}"
|
|
|
}
|
|
|
log.Println("doSearch", sql)
|
|
|
return elastic.Get(INDEX, TYPE, sql)
|