Преглед изворни кода

Merge branch 'feature/pool416_data_business_search' into debug

xyxie пре 1 дан
родитељ
комит
a8b424b3a0
1 измењених фајлова са 24 додато и 2 уклоњено
  1. 24 2
      services/elastic/elastic.go

+ 24 - 2
services/elastic/elastic.go

@@ -1980,12 +1980,34 @@ func SearchDataSourceIndex(indexName, keyword string, source, subSource int, cla
 		shouldMap["should"] = []interface{}{
 			map[string]interface{}{
 				"match": map[string]interface{}{
-					"IndexCode": keyword,
+					"IndexCode": map[string]interface{}{
+						"query":  keyword,
+						"operator": "and",
+					},
 				},
 			},
 			map[string]interface{}{
 				"match": map[string]interface{}{
-					"IndexName": keyword,
+					"IndexName": map[string]interface{}{
+						"query":    keyword,
+						"operator": "and",
+					},
+				},
+			},
+			map[string]interface{}{
+				"match_phrase": map[string]interface{}{
+					"IndexCode": map[string]interface{}{
+						"query":  keyword,
+						"boost":  5,
+					},
+				},
+			},
+			map[string]interface{}{
+				"match_phrase": map[string]interface{}{
+					"IndexName": map[string]interface{}{
+						"query":  keyword,
+						"boost":  5,
+					},
 				},
 			},
 		}