Browse Source

fix:添加限制

duxin 3 years ago
parent
commit
4e37c82ff7

+ 5 - 0
src/jfw/modules/bigmember/src/entity/marketAnalysis/commonSearch.go

@@ -9,6 +9,8 @@ import (
 const (
 const (
 	localMultiMatch     = `{"multi_match": {"query": %s,"type": "phrase", "fields": ["purchasing","pname"]}}`
 	localMultiMatch     = `{"multi_match": {"query": %s,"type": "phrase", "fields": ["purchasing","pname"]}}`
 	query_bool_must_and = `{"bool": {"must": [%s]%s}}`
 	query_bool_must_and = `{"bool": {"must": [%s]%s}}`
+	PSearch_DecMust     = `"bidstatus": ["中标","成交","合同","单一"]`
+	query_bool_must     = `{"terms": {%s}}`
 )
 )
 
 
 //GetCommonQuerySql 公共筛选
 //GetCommonQuerySql 公共筛选
@@ -35,12 +37,15 @@ func (mae *MarketAnalysisEntity) GetCommonQuerySql() string {
 	if len(mae.FormatParam.BuyerClass) > 0 {
 	if len(mae.FormatParam.BuyerClass) > 0 {
 		musts = append(musts, fmt.Sprintf(`{"terms":{"buyerclass":["%s"]}}`, strings.Join(mae.FormatParam.BuyerClass, `","`)))
 		musts = append(musts, fmt.Sprintf(`{"terms":{"buyerclass":["%s"]}}`, strings.Join(mae.FormatParam.BuyerClass, `","`)))
 	}
 	}
+	//分析报告中标状态限制
+	musts = append(musts, fmt.Sprintf(query_bool_must, PSearch_DecMust))
 	//订阅词
 	//订阅词
 	for _, v := range getAllKeywordArr(mae.FormatParam.KeysItems) {
 	for _, v := range getAllKeywordArr(mae.FormatParam.KeysItems) {
 		if sql := getKeyWordSql(v); sql != "" {
 		if sql := getKeyWordSql(v); sql != "" {
 			bools = append(bools, sql)
 			bools = append(bools, sql)
 		}
 		}
 	}
 	}
+
 	return fmt.Sprintf(`{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}%s}`, strings.Join(musts, ","), strings.Join(bools, ","), qutil.If(len(bools) > 0, 1, 0).(int), "%s")
 	return fmt.Sprintf(`{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}%s}`, strings.Join(musts, ","), strings.Join(bools, ","), qutil.If(len(bools) > 0, 1, 0).(int), "%s")
 }
 }