|
@@ -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))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 如果是领域化数据则需要加标签
|
|
// 如果是领域化数据则需要加标签
|