Commit 6aa298b8 by mushishixian

conflict

parents 893cdefc fed36481
Showing with 9 additions and 1 deletions
......@@ -22,7 +22,7 @@ func init() {
// "amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
//}
//
//str := `{"bom_id":237,"delivery_type":1,"sort":2}`
//str := `{"bom_id":369,"delivery_type":1,"sort":2}`
//rabbitmq.Send(queueExchange, str)
}
......
......@@ -209,6 +209,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) {
//先去自营查一遍
search := client.MultiSearch().Index(index)
searchFlag := false
//多重搜索,第一次先去精确匹配
for _, bom := range bomItems {
//如果是模糊查询,还要去截取字符串
......@@ -220,8 +221,13 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor
}
//构建一个goods_name对应的bomItems列表
searchRequest := getSearchParams(index, bom.GoodsName, bom.BrandName, sort, bom.Number, rawSearch)
searchFlag = true
search.Add(searchRequest)
}
//没有搜索条件的话,直接返回空值即可
if !searchFlag {
return nil, err
}
res, err := search.Do(context.Background())
if err != nil {
return
......@@ -307,6 +313,8 @@ func getTermQuery(goodsName, brandName string, number int, flag bool) (query *es
field := "auto_goods_name"
query = query.Must(es.NewTermQuery(field, goodsName))
}
//query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//query = query.Filter(es.NewRangeQuery("stock").Gt(0))
query = query.Filter(es.NewTermQuery("status", 1))
//query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//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