|
@@ -1,8 +1,6 @@
|
|
|
package bidsearch
|
|
|
|
|
|
import (
|
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
- "app.yhyue.com/moapp/jypkg/middleground"
|
|
|
"fmt"
|
|
|
"log"
|
|
|
"net/http"
|
|
@@ -10,6 +8,9 @@ import (
|
|
|
"strings"
|
|
|
"time"
|
|
|
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
+ "app.yhyue.com/moapp/jypkg/middleground"
|
|
|
+
|
|
|
. "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
"app.yhyue.com/moapp/jypkg/public"
|
|
|
|
|
@@ -269,8 +270,8 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
|
|
|
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_missing := `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
|
|
|
- query_bool_must_term := `{"bool": {"must": [{ "term": {"isValidFile": %d }}]}}`
|
|
|
+ query_exists := `{"constant_score":{"filter":{"exists":{"field":"%s"}}}}`
|
|
|
+ query_bool_must_term := `{"bool": {"must": [{ "term": {"isValidFile": %t }}]}}`
|
|
|
query_bool_must_term_domain := `{"bool": {"must": [{ "term": {"bid_field": "%s" }}]}}` // 领域化数据类型
|
|
|
gte := `"gte": %s`
|
|
|
lte := `"lte": %s`
|
|
@@ -344,16 +345,16 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
|
|
|
}
|
|
|
if hasBuyerTel != "" {
|
|
|
if hasBuyerTel == "y" {
|
|
|
- must_not = append(must_not, fmt.Sprintf(query_missing, "buyertel"))
|
|
|
+ musts = append(musts, fmt.Sprintf(query_exists, "buyertel"))
|
|
|
} else {
|
|
|
- musts = append(musts, fmt.Sprintf(query_missing, "buyertel"))
|
|
|
+ must_not = append(must_not, fmt.Sprintf(query_exists, "buyertel"))
|
|
|
}
|
|
|
}
|
|
|
if hasWinnerTel != "" {
|
|
|
if hasWinnerTel == "y" {
|
|
|
- must_not = append(must_not, fmt.Sprintf(query_missing, "winnertel"))
|
|
|
+ musts = append(musts, fmt.Sprintf(query_exists, "winnertel"))
|
|
|
} else {
|
|
|
- musts = append(musts, fmt.Sprintf(query_missing, "winnertel"))
|
|
|
+ must_not = append(must_not, fmt.Sprintf(query_exists, "winnertel"))
|
|
|
}
|
|
|
}
|
|
|
if notkey = strings.TrimSpace(notkey); notkey != "" {
|
|
@@ -376,10 +377,9 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
|
|
|
}
|
|
|
if !isFileSearch && fileExists != "" {
|
|
|
if fileExists == "1" { //有附件
|
|
|
- must_not = append(must_not, fmt.Sprintf(query_missing, "isValidFile"))
|
|
|
- musts = append(musts, fmt.Sprintf(query_bool_must_term, 1))
|
|
|
+ musts = append(musts, fmt.Sprintf(query_bool_must_term, true))
|
|
|
} else if fileExists == "-1" { //无附件
|
|
|
- musts = append(musts, fmt.Sprintf(query_missing, "isValidFile"))
|
|
|
+ must_not = append(must_not, fmt.Sprintf(query_bool_must_term, true))
|
|
|
}
|
|
|
}
|
|
|
// 如果是领域化数据则需要加标签
|