Commit 28618b14 by mushishixian

fix conflict

parents ddf63ad0 fed36481
Showing with 13 additions and 1 deletions
...@@ -14,6 +14,7 @@ type RecvPro struct { ...@@ -14,6 +14,7 @@ type RecvPro struct {
} }
func init() { func init() {
<<<<<<< HEAD
queueExchange := rabbitmq.QueueExchange{ queueExchange := rabbitmq.QueueExchange{
"bom_match", "bom_match",
"bom_match", "bom_match",
......
...@@ -220,6 +220,7 @@ func removeZiyingMatchBomItem(ziyingGoodsMapList []GoodsMap, bomItems []model.Bo ...@@ -220,6 +220,7 @@ func removeZiyingMatchBomItem(ziyingGoodsMapList []GoodsMap, bomItems []model.Bo
func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sort int, client *es.Client, rawSearch bool) (goodsMapList []GoodsMap, err error) { func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sort int, client *es.Client, rawSearch bool) (goodsMapList []GoodsMap, err error) {
//先去自营查一遍 //先去自营查一遍
search := client.MultiSearch().Index(index) search := client.MultiSearch().Index(index)
searchFlag := false
//多重搜索,第一次先去精确匹配 //多重搜索,第一次先去精确匹配
for _, bom := range bomItems { for _, bom := range bomItems {
//如果是模糊查询,还要去截取字符串 //如果是模糊查询,还要去截取字符串
...@@ -232,9 +233,14 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor ...@@ -232,9 +233,14 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor
} }
//构建一个goods_name对应的bomItems列表 //构建一个goods_name对应的bomItems列表
searchRequest := getSearchParams(index, bom.GoodsName, bom.BrandName, sort, bom.Number, rawSearch) searchRequest := getSearchParams(index, bom.GoodsName, bom.BrandName, sort, bom.Number, rawSearch)
searchFlag = true
search.Add(searchRequest) search.Add(searchRequest)
} }
//:todo 这里有bug
//没有搜索条件的话,直接返回空值即可
if !searchFlag {
return nil, err
}
res, err := search.Do(context.Background()) res, err := search.Do(context.Background())
if err != nil { if err != nil {
return return
...@@ -320,6 +326,11 @@ func getTermQuery(goodsName, brandName string, number int, flag bool) (query *es ...@@ -320,6 +326,11 @@ func getTermQuery(goodsName, brandName string, number int, flag bool) (query *es
field := "auto_goods_name" field := "auto_goods_name"
query = query.Must(es.NewTermQuery(field, goodsName)) query = query.Must(es.NewTermQuery(field, goodsName))
} }
<<<<<<< HEAD
=======
//query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//query = query.Filter(es.NewRangeQuery("stock").Gt(0))
>>>>>>> ysx-修复数据-20200609
query = query.Filter(es.NewTermQuery("status", 1)) query = query.Filter(es.NewTermQuery("status", 1))
//query = query.Filter(es.NewRangeQuery("single_price").Gt(0)) //query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//src, err := query.Source() //src, err := query.Source()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment