WH01243 1 rok pred
rodič
commit
a3df7d881c

+ 42 - 14
src/jfw/front/searchOptimize.go

@@ -93,16 +93,16 @@ type SearchOptimize struct {
 	PropertyForm        string        `json:"propertyForm"`   //物业业态
 	ExpireTime          string        `json:"expireTime"`     //到期时间
 	Subinformation      string        `json:"subinformation"` //业务类型
-	Period              int           `json:"period"`         //合同周期
-	Changehand          int           `json:"changehand"`     //价格区间
-	Scale               int           `json:"scale"`          //换手率
+	Period              string        `json:"period"`         //合同周期
+	Changehand          int           `json:"changehand"`     // 换手率
+	Scale               string        `json:"scale"`          //价格区间
 	Isfile              int           `json:"isfile"`         //有无附件
 
 }
 
 // NewSearchOptimize  初始化
 func NewSearchOptimize(userId, phone, province, city, district, subtype, topType, publishTime, selectType, price, industry, buyerClass, buyerTel, winnerTel, fileExists, keyWords, additionalWords, exclusionWords, platform, territorialization, expireTime, propertyForm, subinformation string,
-	pageNum, pageSize, searchGroup, searchMode, wordsMode, period, scale, changehand, isfile int,
+	pageNum, pageSize, searchGroup, searchMode, wordsMode int, period, scale string, changehand, isfile int,
 	userInfo jy.VipState, searchTypeSwitch bool, r *http.Request, accountId, entAccountId, entId, entUserId int64) *SearchOptimize {
 	IsPay := userInfo.IsPayedUser()
 	if territorialization == "BIProperty" {
@@ -538,22 +538,38 @@ func (so *SearchOptimize) GetSearchQuery(mustQuery string) (qstr string) {
 	}
 	//物业业态
 	if so.PropertyForm != "" && isLogin {
-		musts = append(musts, fmt.Sprintf(queryBoolShould, fmt.Sprintf(`{"terms":{"property_form":[%s]}}`, so.PropertyForm)))
+		arr := []string{}
+		for _, v := range strings.Split(so.PropertyForm, ",") {
+			arr = append(arr, fmt.Sprintf(`"%s"`, v))
+		}
+		musts = append(musts, fmt.Sprintf(queryBoolShould, fmt.Sprintf(`{"terms":{"tag_set.wuye.property_form":[%s]}}`, strings.Join(arr, ","))))
 		//musts = append(musts, fmt.Sprintf(queryBoolShould, "property_form", `"`+strings.ReplaceAll(so.PropertyForm, ", ", `", "`)+`"`))
 	}
 	//业务类型
 	if so.Subinformation != "" && isLogin {
-		musts = append(musts, fmt.Sprintf(queryBoolShould, fmt.Sprintf(`{"terms":{"tag_subinformation":[%s]}}`, so.Subinformation)))
+		arr := []string{}
+		for _, v := range strings.Split(so.Subinformation, ",") {
+			arr = append(arr, fmt.Sprintf(`"%s"`, v))
+		}
+		musts = append(musts, fmt.Sprintf(queryBoolShould, fmt.Sprintf(`{"terms":{"tag_subinformation":[%s]}}`, strings.Join(arr, ","))))
 		//musts = append(musts, fmt.Sprintf(queryBoolShould, "tag_subinformation", `"`+strings.ReplaceAll(so.Subinformation, ", ", `", "`)+`"`))
 	}
 	//价格区间
-	if so.Scale != 0 && isLogin {
-		musts = append(musts, fmt.Sprintf(queryBoolShould, fmt.Sprintf(`{"terms":{"tag_set.wuye.scale":[%s]}}`, so.Scale)))
+	if so.Scale != "" && isLogin {
+		arr := []string{}
+		for _, v := range strings.Split(so.Scale, ",") {
+			arr = append(arr, fmt.Sprintf(`"%s"`, v))
+		}
+		musts = append(musts, fmt.Sprintf(queryBoolShould, fmt.Sprintf(`{"terms":{"tag_set.wuye.scale":[%s]}}`, strings.Join(arr, ","))))
 		//musts = append(musts, fmt.Sprintf(queryBoolShould, "tag_set.wuye.scale", `"`+gconv.String(so.Scale)+`"`))
 	}
 	//合同周期
-	if so.Period != 0 && isLogin {
-		musts = append(musts, fmt.Sprintf(queryBoolShould, fmt.Sprintf(`{"terms":{"tag_set.wuye.period":[%s]}}`, so.Period)))
+	if so.Period != "" && isLogin {
+		arr := []string{}
+		for _, v := range strings.Split(so.Period, ",") {
+			arr = append(arr, fmt.Sprintf(`"%s"`, v))
+		}
+		musts = append(musts, fmt.Sprintf(queryBoolShould, fmt.Sprintf(`{"terms":{"tag_set.wuye.period":[%s]}}`, strings.Join(arr, ","))))
 		//musts = append(musts, fmt.Sprintf(queryBoolShould, "tag_set.wuye.period", `"`+gconv.String(so.Period)+`"`))
 	}
 	//换手率
@@ -625,11 +641,23 @@ func (so *SearchOptimize) GetSearchQuery(mustQuery string) (qstr string) {
 	}
 	//附件
 	fileExists := so.FileExists
+
 	if !isFileSearch && fileExists != "" && isLogin {
-		if fileExists == "1" { //有附件
-			musts = append(musts, fmt.Sprintf(queryBoolMustTerm, true))
-		} else if fileExists == "-1" { //无附件
-			mustNot = append(mustNot, fmt.Sprintf(queryBoolMustTerm, true))
+		if so.BidField == "BIProperty" {
+			//物业
+			if fileExists == "1" {
+				//存在
+				musts = append(musts, fmt.Sprintf(queryBoolMustA, "tag_set.wuye.isfile", `"63"`))
+			} else if fileExists == "-1" {
+				//不存在
+				mustNot = append(mustNot, fmt.Sprintf(queryExists, "tag_set.wuye.isfile"))
+			}
+		} else {
+			if fileExists == "1" { //有附件
+				musts = append(musts, fmt.Sprintf(queryBoolMustTerm, true))
+			} else if fileExists == "-1" { //无附件
+				mustNot = append(mustNot, fmt.Sprintf(queryBoolMustTerm, true))
+			}
 		}
 	}
 	// 如果是领域化数据则需要加标签

+ 1 - 1
src/jfw/front/supsearch.go

@@ -518,7 +518,7 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 	if isSearch {
 		searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
 		so := NewSearchOptimize(userId, phone, area, city, district, subtype, toptype, publishtime, strings.Join(queryItems, ","), fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, "", "", "",
-			0, pageSize, searchGroup, searchMode, wordsMode, 0, 0, 0, 0,
+			0, pageSize, searchGroup, searchMode, wordsMode, "", "", 0, 0,
 			*userInfo, searchTypeSwitch, p.Request, accountId, entAccountId, entId, entUserId)
 		heightKeys = so.HeightKeys //主关键词和附加词合并,多组空格隔开,作为前端渲染高亮关键词使用
 		//关键词  行业 附加词

+ 2 - 2
src/jfw/front/swordfish.go

@@ -128,9 +128,9 @@ func (m *Front) PcAjaxReq() {
 	//业务类型  subinformation
 	subinformation := m.GetString("subinformation")
 	//合同周期 period
-	period, _ := m.GetInteger("period")
+	period := m.GetString("period")
 	//价格区间 scale
-	scale, _ := m.GetInteger("scale")
+	scale := m.GetString("scale")
 	//价格区间 scale
 	isfile, _ := m.GetInteger("isfile")
 	//换手率 changehand