Переглянути джерело

Merge branch 'feature/v1.1.12' of http://192.168.3.207:8080/BaseService/jyMicroservices into feature/v1.1.12

fuwencai 2 роки тому
батько
коміт
228d27fc41

+ 0 - 1
jyBXCore/rpc/model/es/es.go

@@ -22,7 +22,6 @@ const (
 	HL                      = `"highlight": {"pre_tags": [""],"post_tags": [""],"fields": {%s}}`
 	INDEX                   = "bidding"
 	TYPE                    = "bidding"
-	QueryBoolShould         = `{"bool":{"should":[%s],"minimum_should_match": 1}}`
 	BidSearchSort           = `{"dataweight":-1,"publishtime":-1}`
 	BidSearchFieldBase      = `"_id","title","publishtime","dataweight","toptype","subtype","type","area","city","s_subscopeclass","bidamount","budget","buyerclass","spidercode","site"`                                                    //搜索列表基础字段
 	BidSearchFieldOfVip     = BidSearchFieldBase + `,"buyer","buyertel","buyerperson","agency","agencytel","agencyperson","s_winner","winnertel","winnerperson","signendtime","bidendtime","bidopentime","budget","projectinfo","entidlist"` //付费列表字段

+ 8 - 8
jyBXCore/rpc/model/es/search.go

@@ -14,7 +14,7 @@ import (
 // GetSearchQuery  整理关键词等查询条件
 func GetSearchQuery(in *bxcore.SearchReq, mustQuery string) (qstr string) {
 	var (
-		musts, must_not []string
+		musts, mustNot []string
 	)
 	if mustQuery != "" {
 		musts = append(musts, mustQuery)
@@ -100,7 +100,7 @@ func GetSearchQuery(in *bxcore.SearchReq, mustQuery string) (qstr string) {
 	hasBuyerTel := in.BuyerTel
 	if hasBuyerTel != "" {
 		if hasBuyerTel == "y" {
-			must_not = append(must_not, fmt.Sprintf(queryMissing, "buyertel"))
+			mustNot = append(mustNot, fmt.Sprintf(queryMissing, "buyertel"))
 		} else {
 			musts = append(musts, fmt.Sprintf(queryMissing, "buyertel"))
 		}
@@ -108,7 +108,7 @@ func GetSearchQuery(in *bxcore.SearchReq, mustQuery string) (qstr string) {
 	hasWinnerTel := in.WinnerTel
 	if hasWinnerTel != "" {
 		if hasWinnerTel == "y" {
-			must_not = append(must_not, fmt.Sprintf(queryMissing, "winnertel"))
+			mustNot = append(mustNot, fmt.Sprintf(queryMissing, "winnertel"))
 		} else {
 			musts = append(musts, fmt.Sprintf(queryMissing, "winnertel"))
 		}
@@ -130,19 +130,19 @@ func GetSearchQuery(in *bxcore.SearchReq, mustQuery string) (qstr string) {
 			}
 			notKeyMustNot = append(notKeyMustNot, fmt.Sprintf(notKeyMultiMatch, elastic.ReplaceYH(v)))
 		}
-		must_not = append(must_not, fmt.Sprintf(queryBoolShould, strings.Join(notKeyMustNot, ",")))
+		mustNot = append(mustNot, fmt.Sprintf(queryBoolShould, strings.Join(notKeyMustNot, ",")))
 	}
 	//
 	fileExists := in.FileExists
 	if !isFileSearch && fileExists != "" {
 		if fileExists == "1" { //有附件
-			must_not = append(must_not, fmt.Sprintf(queryMissing, "isValidFile"))
+			mustNot = append(mustNot, fmt.Sprintf(queryMissing, "isValidFile"))
 			musts = append(musts, fmt.Sprintf(queryBoolMustTerm, 1))
 		} else if fileExists == "-1" { //无附件
 			musts = append(musts, fmt.Sprintf(queryMissing, "isValidFile"))
 		}
 	}
-	qstr = fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","))
+	qstr = fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(mustNot, ","))
 	logx.Info("qstr:", qstr)
 	return
 }
@@ -178,7 +178,7 @@ func GetBidSearchQuery(in *bxcore.SearchReq) string {
 		query += `]}}`
 	}
 	if query != "" {
-		query = fmt.Sprintf(QueryBoolShould, query)
+		query = fmt.Sprintf(queryBoolShould, query)
 	}
 	//发布时间
 	publishtime := in.PublishTime
@@ -241,7 +241,7 @@ func GetBidSearchQuery(in *bxcore.SearchReq) string {
 		if query != "" {
 			query += ","
 		}
-		query += fmt.Sprintf(QueryBoolShould, alltype)
+		query += fmt.Sprintf(queryBoolShould, alltype)
 	}
 	//采购单位类型
 	buyerclass := in.BuyerClass

+ 1 - 1
jyBXCore/rpc/service/search.go

@@ -35,7 +35,7 @@ func GetBidSearchData(in *bxcore.SearchReq, isCache bool) (count int64, list []*
 		count, repl = biddingSearch.GetAllByNgramWithCount()
 		if repl != nil && *repl != nil && len(*repl) > 0 {
 			//格式化查询结果
-			list = util.SearchListFormat(in.Industry, repl, true)
+			list = util.SearchListFormat(in.Industry, repl, strings.Contains(in.SelectType, "detail"))
 		} else {
 			logx.Info("查询数据异常")
 		}