WH01243 2 жил өмнө
parent
commit
6848beb9d9

+ 7 - 4
src/jfw/modules/bigmember/src/service/analysis/forecastproject.go

@@ -35,7 +35,7 @@ const (
 	filter_must_time         = `{"bool":{"%s":[{"exists":{"field":"top_category"}}]}},{"bool":{"should":[{"bool":{"must":[{"constant_score":{"filter":{"exists":{"field":"yuceendtime"}}}},{"range":{"yuceendtime":{"gte":%d,"lte":%d}}}]}}]}}`
 	filter_must_area_city    = `{"bool":{"should":[%s]}}`
 	query_should_keys        = `{"bool":{"must":[%s],"must_not":[%s]}}`
-	query_should_multi_match = `{"multi_match":{"query":"%s","type":"phrase","fields":["results.purchasing.mypurchasing"]}}`
+	query_should_multi_match = `{"multi_match":{"query":"%s","type":"phrase","fields":["%s"]}}`
 )
 
 /*
@@ -56,9 +56,12 @@ func getForecastProjectSql(scd *util.ViewCondition, startTime, endTime int, data
 	if endTime == 0 {
 		endTime = int(time.Now().Unix())
 	}
+	name := ""
 	if dataType == "nj" {
+		name = "title"
 		musts = append(musts, fmt.Sprintf(filter_must_time, "must", startTime, endTime))
 	} else {
+		name = "results.purchasing.mypurchasing"
 		musts = append(musts, fmt.Sprintf(filter_must_time, "must_not", startTime, endTime))
 	}
 	//省份
@@ -112,16 +115,16 @@ func getForecastProjectSql(scd *util.ViewCondition, startTime, endTime int, data
 			bool_must_not := []string{}
 			//附加词
 			for _, vv := range v.Keyword {
-				bool_must = append(bool_must, fmt.Sprintf(multi_match, vv))
+				bool_must = append(bool_must, fmt.Sprintf(multi_match, vv, name))
 			}
 
 			for _, vv := range v.Appended {
-				bool_must = append(bool_must, fmt.Sprintf(multi_match, vv))
+				bool_must = append(bool_must, fmt.Sprintf(multi_match, vv, name))
 			}
 
 			//排除词
 			for _, vv := range v.Exclude {
-				bool_must_not = append(bool_must_not, fmt.Sprintf(multi_match, vv))
+				bool_must_not = append(bool_must_not, fmt.Sprintf(multi_match, vv, name))
 			}
 
 			//添加