|
@@ -7,7 +7,6 @@ import (
|
|
|
)
|
|
|
|
|
|
const (
|
|
|
- localMultiMatch = `{"multi_match": {"query": %s,"type": "phrase", "fields": ["purchasing","projectname.pname"]}}`
|
|
|
query_bool_must_and = `{"bool": {"must": [%s]%s}}`
|
|
|
PSearch_DecMust = `"bidstatus": ["中标","成交","合同","单一"]`
|
|
|
query_bool_must = `{"terms": {%s}}`
|
|
@@ -41,7 +40,7 @@ func (mae *MarketAnalysisEntity) GetCommonQuerySql() string {
|
|
|
musts = append(musts, fmt.Sprintf(query_bool_must, PSearch_DecMust))
|
|
|
//订阅词
|
|
|
for _, v := range getAllKeywordArr(mae.FormatParam.KeysItems) {
|
|
|
- if sql := getKeyWordSql(v); sql != "" {
|
|
|
+ if sql := getKeyWordSql(v, mae.BaseParam.MatchingMode); sql != "" {
|
|
|
bools = append(bools, sql)
|
|
|
}
|
|
|
}
|
|
@@ -92,8 +91,15 @@ func getAllKeywordArr(res []keyWordGroup) (rData []viewKeyWord) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func getKeyWordSql(v viewKeyWord) string {
|
|
|
- var shoulds, must_not []string
|
|
|
+func getKeyWordSql(v viewKeyWord, matchingMode string) string {
|
|
|
+ var (
|
|
|
+ shoulds, must_not []string
|
|
|
+ //默认查询项目名称与标的物
|
|
|
+ localMultiMatch = `{"multi_match": {"query": %s,"type": "phrase", "fields": ["purchasing","projectname.pname"]}}`
|
|
|
+ )
|
|
|
+ if matchingMode == "title" { //只匹配项目名称
|
|
|
+ localMultiMatch = `{"multi_match": {"query": %s,"type": "phrase", "fields": ["projectname.pname"]}}`
|
|
|
+ }
|
|
|
//附加词
|
|
|
for _, vv := range v.Keyword {
|
|
|
vv = strings.TrimSpace(vv)
|