فهرست منبع

物业搜索修改

WH01243 1 سال پیش
والد
کامیت
a3df7d881c
3فایلهای تغییر یافته به همراه45 افزوده شده و 17 حذف شده
  1. 42 14
      src/jfw/front/searchOptimize.go
  2. 1 1
      src/jfw/front/supsearch.go
  3. 2 2
      src/jfw/front/swordfish.go

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

@@ -93,16 +93,16 @@ type SearchOptimize struct {
 	PropertyForm        string        `json:"propertyForm"`   //物业业态
 	PropertyForm        string        `json:"propertyForm"`   //物业业态
 	ExpireTime          string        `json:"expireTime"`     //到期时间
 	ExpireTime          string        `json:"expireTime"`     //到期时间
 	Subinformation      string        `json:"subinformation"` //业务类型
 	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"`         //有无附件
 	Isfile              int           `json:"isfile"`         //有无附件
 
 
 }
 }
 
 
 // NewSearchOptimize  初始化
 // 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,
 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 {
 	userInfo jy.VipState, searchTypeSwitch bool, r *http.Request, accountId, entAccountId, entId, entUserId int64) *SearchOptimize {
 	IsPay := userInfo.IsPayedUser()
 	IsPay := userInfo.IsPayedUser()
 	if territorialization == "BIProperty" {
 	if territorialization == "BIProperty" {
@@ -538,22 +538,38 @@ func (so *SearchOptimize) GetSearchQuery(mustQuery string) (qstr string) {
 	}
 	}
 	//物业业态
 	//物业业态
 	if so.PropertyForm != "" && isLogin {
 	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, ", ", `", "`)+`"`))
 		//musts = append(musts, fmt.Sprintf(queryBoolShould, "property_form", `"`+strings.ReplaceAll(so.PropertyForm, ", ", `", "`)+`"`))
 	}
 	}
 	//业务类型
 	//业务类型
 	if so.Subinformation != "" && isLogin {
 	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, ", ", `", "`)+`"`))
 		//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)+`"`))
 		//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)+`"`))
 		//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
 	fileExists := so.FileExists
+
 	if !isFileSearch && fileExists != "" && isLogin {
 	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 {
 	if isSearch {
 		searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
 		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, "", "", "",
 		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)
 			*userInfo, searchTypeSwitch, p.Request, accountId, entAccountId, entId, entUserId)
 		heightKeys = so.HeightKeys //主关键词和附加词合并,多组空格隔开,作为前端渲染高亮关键词使用
 		heightKeys = so.HeightKeys //主关键词和附加词合并,多组空格隔开,作为前端渲染高亮关键词使用
 		//关键词  行业 附加词
 		//关键词  行业 附加词

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

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