瀏覽代碼

订阅修改

WH01243 1 年之前
父節點
當前提交
9eb87a0477
共有 2 個文件被更改,包括 14 次插入1 次删除
  1. 1 0
      jyBXCore/rpc/entity/search.go
  2. 13 1
      jyBXCore/rpc/model/es/search.go

+ 1 - 0
jyBXCore/rpc/entity/search.go

@@ -242,6 +242,7 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
 		in.WinnerTel = ""
 		in.ExclusionWords = ""
 		in.City = ""
+		in.District = ""
 		in.ExclusionWords = ""
 	}
 	//判断是否有关键词

+ 13 - 1
jyBXCore/rpc/model/es/search.go

@@ -238,6 +238,18 @@ func GetBidSearchQuery(in *bxcore.SearchReq) string {
 	}
 	district := in.District
 	if district != "" {
+		for k, v := range strings.Split(district, ",") {
+			if k > 0 {
+				query += `,`
+			}
+			cityName := strings.Split(v, "_")[0]
+			districtName := strings.Split(v, "_")[1]
+			query_bool_must_and_district := `{"bool":{"must":[{"terms":{"city":["%s"]}},{"terms":{"district":["%s"]}}]}}`
+			query += fmt.Sprintf(query_bool_must_and_district, cityName, districtName)
+		}
+
+	}
+	/*if district != "" {
 		for _, v := range strings.Split(district, ",") {
 			if len(v) > 0 {
 				query += ","
@@ -256,7 +268,7 @@ func GetBidSearchQuery(in *bxcore.SearchReq) string {
 			query += `]}}`
 		}
 
-	}
+	}*/
 	if query != "" {
 		query = fmt.Sprintf(queryBoolShould, query)
 	}