|
@@ -335,6 +335,7 @@ func GetSearchQuery(in *bxcore.SearchReq, mustquery string) (qstr string) {
|
|
|
query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
|
|
|
query_bools_must := `{"bool":{"must":[{"range":{"bidamount":{%s}}}]}},{"bool":{"must":[{"range":{"budget":{%s}}}],"must_not":[{"range":{"bidamount":{"gte":-1}}}]}}`
|
|
|
query_bool_must := `{"bool":{"must":[{"terms":{"s_subscopeclass":[%s]}}]}}`
|
|
|
+ query_bool_must_term := `{"bool": {"must": [{ "term": {"isValidFile": %d }}]}}`
|
|
|
query_missing := `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
|
|
|
gte := `"gte": %s`
|
|
|
lte := `"lte": %s`
|
|
@@ -442,9 +443,10 @@ func GetSearchQuery(in *bxcore.SearchReq, mustquery string) (qstr string) {
|
|
|
fileExists := in.FileExists
|
|
|
if !isFileSearch && fileExists != "" {
|
|
|
if fileExists == "1" { //有附件
|
|
|
- must_not = append(must_not, fmt.Sprintf(query_missing, "filetext"))
|
|
|
+ must_not = append(must_not, fmt.Sprintf(query_missing, "isValidFile"))
|
|
|
+ musts = append(musts, fmt.Sprintf(query_bool_must_term, 1))
|
|
|
} else if fileExists == "-1" { //无附件
|
|
|
- musts = append(musts, fmt.Sprintf(query_missing, "filetext"))
|
|
|
+ musts = append(musts, fmt.Sprintf(query_missing, "isValidFile"))
|
|
|
}
|
|
|
}
|
|
|
qstr = fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","))
|