|
@@ -107,6 +107,29 @@ func GetSearchQuery(in *bxcore.SearchReq, mustQuery string) (qstr string) {
|
|
|
} else if len(wordsMusts) > 0 {
|
|
|
musts = append(musts, fmt.Sprintf(elastic.NgramMust, strings.Join(wordsMusts, ",")))
|
|
|
}
|
|
|
+ //排除词
|
|
|
+ if notKey := strings.TrimSpace(in.ExclusionWords); notKey != "" {
|
|
|
+ notKeyMultiMatch := fmt.Sprintf(multiMatch, "%s", findFields)
|
|
|
+ var notKeyMustNot []string
|
|
|
+ //多组排除词
|
|
|
+ for _, nks := range strings.Split(notKey, ",") {
|
|
|
+ //单组排除词 空格分割
|
|
|
+ for _, v := range strings.Split(nks, IC.C.JYKeyMark) {
|
|
|
+ v = strings.TrimSpace(v)
|
|
|
+ if v == "" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if len([]rune(elastic.ReplaceYH(v))) == 1 {
|
|
|
+ //单个字 搜索范围 有全文或者附件 无标题 例如:学 虚拟机 detail 搜索的时候加上标题
|
|
|
+ if DetailFileORTitle(findFields) {
|
|
|
+ notKeyMultiMatch = fmt.Sprintf(multiMatch, "%s", findFields+`,"title"`)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ notKeyMustNot = append(notKeyMustNot, fmt.Sprintf(notKeyMultiMatch, elastic.ReplaceYH(v)))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mustNot = append(mustNot, fmt.Sprintf(queryBoolShould, strings.Join(notKeyMustNot, ",")))
|
|
|
+ }
|
|
|
//行业
|
|
|
if in.Industry != "" {
|
|
|
musts = append(musts, fmt.Sprintf(queryBoolMust, `"`+strings.ReplaceAll(in.Industry, ",", `","`)+`"`))
|
|
@@ -145,6 +168,7 @@ func GetSearchQuery(in *bxcore.SearchReq, mustQuery string) (qstr string) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //采购单位联系方式
|
|
|
hasBuyerTel := in.BuyerTel
|
|
|
if hasBuyerTel != "" {
|
|
|
if hasBuyerTel == "y" {
|
|
@@ -153,6 +177,7 @@ func GetSearchQuery(in *bxcore.SearchReq, mustQuery string) (qstr string) {
|
|
|
musts = append(musts, fmt.Sprintf(queryMissing, "buyertel"))
|
|
|
}
|
|
|
}
|
|
|
+ //中标企业联系方式
|
|
|
hasWinnerTel := in.WinnerTel
|
|
|
if hasWinnerTel != "" {
|
|
|
if hasWinnerTel == "y" {
|
|
@@ -161,26 +186,7 @@ func GetSearchQuery(in *bxcore.SearchReq, mustQuery string) (qstr string) {
|
|
|
musts = append(musts, fmt.Sprintf(queryMissing, "winnertel"))
|
|
|
}
|
|
|
}
|
|
|
- //排除词
|
|
|
- if notKey := strings.TrimSpace(in.ExclusionWords); notKey != "" {
|
|
|
- notKeyMultiMatch := fmt.Sprintf(multiMatch, "%s", findFields)
|
|
|
- var notKeyMustNot []string
|
|
|
- for _, v := range strings.Split(notKey, IC.C.JYKeyMark) {
|
|
|
- v = strings.TrimSpace(v)
|
|
|
- if v == "" {
|
|
|
- continue
|
|
|
- }
|
|
|
- if len([]rune(elastic.ReplaceYH(v))) == 1 {
|
|
|
- //单个字 搜索范围 有全文或者附件 无标题 例如:学 虚拟机 detail 搜索的时候加上标题
|
|
|
- if DetailFileORTitle(findFields) {
|
|
|
- notKeyMultiMatch = fmt.Sprintf(multiMatch, "%s", findFields+`,"title"`)
|
|
|
- }
|
|
|
- }
|
|
|
- notKeyMustNot = append(notKeyMustNot, fmt.Sprintf(notKeyMultiMatch, elastic.ReplaceYH(v)))
|
|
|
- }
|
|
|
- mustNot = append(mustNot, fmt.Sprintf(queryBoolShould, strings.Join(notKeyMustNot, ",")))
|
|
|
- }
|
|
|
- //
|
|
|
+ //附件
|
|
|
fileExists := in.FileExists
|
|
|
if !isFileSearch && fileExists != "" {
|
|
|
if fileExists == "1" { //有附件
|