|
@@ -1,13 +1,13 @@
|
|
|
package logic
|
|
|
|
|
|
import (
|
|
|
- "context"
|
|
|
- "strconv"
|
|
|
- "strings"
|
|
|
-
|
|
|
IC "app.yhyue.com/moapp/jyInfo/rpc/consumer/init"
|
|
|
"app.yhyue.com/moapp/jyInfo/rpc/model/es"
|
|
|
"app.yhyue.com/moapp/jyInfo/rpc/util"
|
|
|
+ "context"
|
|
|
+ "fmt"
|
|
|
+ "strconv"
|
|
|
+ "strings"
|
|
|
|
|
|
se "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
|
|
@@ -42,15 +42,28 @@ func (l *SupplyInfoSearchLogic) SupplyInfoSearch(in *consumerinfo.SupplyInfoSear
|
|
|
if in.PageIndex == 0 {
|
|
|
in.PageIndex = 1
|
|
|
}
|
|
|
- //空格多个关键词
|
|
|
- if strings.Contains(in.Keywords, "+") {
|
|
|
- in.Keywords = strings.ReplaceAll(in.Keywords, " ", "+")
|
|
|
- }
|
|
|
+ //空格多个关键词 以后可能会出现 关键词 C++ 等带+的关键词
|
|
|
+ //if strings.Contains(in.Keywords, "+") {
|
|
|
+ in.Keywords = strings.ReplaceAll(in.Keywords, " ", "+")
|
|
|
+ //}
|
|
|
list, total := model.GetSupplyInfoList(in, true)
|
|
|
logx.Info("ttt---", total, "----", in.Keywords)
|
|
|
- if total == 0 && len([]rune(in.Keywords)) > 3 {
|
|
|
+ if in.PageIndex == 1 && total < in.PageSize && len([]rune(in.Keywords)) > 3 {
|
|
|
if secondKWS := util.HttpEsGetWords(in.Keywords, "ik_smart", IC.C.Es.Addr); secondKWS != "" {
|
|
|
- in.Keywords = secondKWS
|
|
|
+ //分词后查询数据量有可能小于不分词查询数据量 -- 原因:未分词前是全文查询 分词后是标题查询;
|
|
|
+ secondKWS = fmt.Sprintf("%s+%s", in.Keywords, secondKWS)
|
|
|
+ var kbool = map[string]bool{}
|
|
|
+ var karr = []string{}
|
|
|
+ for _, v := range strings.Split(secondKWS, "+") {
|
|
|
+ if kbool[v] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ karr = append(karr, v)
|
|
|
+ kbool[v] = true
|
|
|
+ }
|
|
|
+ in.Keywords = strings.Join(karr, "+")
|
|
|
+ in.PageSize = 100
|
|
|
+ //in.Keywords = secondKWS
|
|
|
list, total = model.GetSupplyInfoList(in, false)
|
|
|
}
|
|
|
}
|