Commit 4ecfdd6a by mushishixian

优化参数查询

parent faa39dc5
......@@ -24,7 +24,7 @@ func main() {
port := config.Get("web.port").String()
//web改成micro 就是grpc,并直接注册到etcd里面
service := web.NewService(
web.Name("go.micro.api.http.bom"),
web.Name("go.micro.api.http.search"),
web.Handler(r),
web.Address(":"+port),
)
......
[web]
port = 9000
mode = debug
[message]
api_domain = http://api.ichunt.com/msg/sendMessageByAuto
......
......@@ -7,7 +7,7 @@ import (
"search_server/service"
)
func init() {
func Init() {
courseService := service.NewCourseServiceImpl()
gin_.NewBuilder().WithService(courseService).
WithMiddleware(Check_Middleware()).
......
......@@ -7,7 +7,7 @@ import (
"search_server/service"
)
func init() {
func Init2() {
courseService:=service.NewCourseTopicServiceImpl()
gin_.NewBuilder().WithService(courseService).
WithMiddleware(Check_Middleware()).
......
......@@ -121,16 +121,16 @@ func (m *AutoSpuResponse) GetData() []string {
type RecommendRequest struct {
// @inject_tag: form:"goods_name"
GoodsName string `protobuf:"bytes,1,opt,name=goods_name,json=goodsName,proto3" json:"goods_name,omitempty" form:"goods_name"`
// @inject_tag: form:"attrs"
Attrs string `protobuf:"bytes,2,opt,name=attrs,proto3" json:"attrs,omitempty" form:"attrs"`
// @inject_tag: form:"encap"
Encap string `protobuf:"bytes,3,opt,name=encap,proto3" json:"encap,omitempty" form:"encap"`
// @inject_tag: form:"num"
Num int32 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty" form:"num"`
Num int32 `protobuf:"varint,4,opt,name=num,proto3" json:"num,omitempty" form:"num"`
// @inject_tag: form:"delivery_type"
DeliveryType int32 `protobuf:"varint,3,opt,name=delivery_type,json=deliveryType,proto3" json:"delivery_type,omitempty" form:"delivery_type"`
DeliveryType int32 `protobuf:"varint,5,opt,name=delivery_type,json=deliveryType,proto3" json:"delivery_type,omitempty" form:"delivery_type"`
// @inject_tag: form:"flag"
Flag int32 `protobuf:"varint,4,opt,name=flag,proto3" json:"flag,omitempty" form:"flag"`
// @inject_tag: form:"p"
P int32 `protobuf:"varint,5,opt,name=p,proto3" json:"p,omitempty" form:"p"`
// @inject_tag: form:"offset"
Offset int32 `protobuf:"varint,6,opt,name=offset,proto3" json:"offset,omitempty" form:"offset"`
Flag int32 `protobuf:"varint,6,opt,name=flag,proto3" json:"flag,omitempty" form:"flag"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -168,37 +168,37 @@ func (m *RecommendRequest) GetGoodsName() string {
return ""
}
func (m *RecommendRequest) GetNum() int32 {
func (m *RecommendRequest) GetAttrs() string {
if m != nil {
return m.Num
return m.Attrs
}
return 0
return ""
}
func (m *RecommendRequest) GetDeliveryType() int32 {
func (m *RecommendRequest) GetEncap() string {
if m != nil {
return m.DeliveryType
return m.Encap
}
return 0
return ""
}
func (m *RecommendRequest) GetFlag() int32 {
func (m *RecommendRequest) GetNum() int32 {
if m != nil {
return m.Flag
return m.Num
}
return 0
}
func (m *RecommendRequest) GetP() int32 {
func (m *RecommendRequest) GetDeliveryType() int32 {
if m != nil {
return m.P
return m.DeliveryType
}
return 0
}
func (m *RecommendRequest) GetOffset() int32 {
func (m *RecommendRequest) GetFlag() int32 {
if m != nil {
return m.Offset
return m.Flag
}
return 0
}
......@@ -804,68 +804,68 @@ func init() {
func init() { proto.RegisterFile("bom.proto", fileDescriptor_f689add15dae9986) }
var fileDescriptor_f689add15dae9986 = []byte{
// 1003 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x73, 0xdb, 0x36,
0x10, 0x1d, 0x59, 0xb1, 0x64, 0x2d, 0x69, 0x5b, 0x61, 0x1c, 0x07, 0xf9, 0x70, 0x63, 0xcb, 0x71,
0xaa, 0x76, 0x3a, 0x69, 0xad, 0xe6, 0x0f, 0xd8, 0x96, 0xa7, 0xd5, 0x4c, 0xd3, 0x66, 0x28, 0x65,
0x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0x41, 0x73, 0xef, 0xfe,
0x13, 0x78, 0x71, 0xb2, 0x0b, 0xd2, 0xb7, 0x61, 0xda, 0xc2, 0x7f, 0x0f, 0x3f, 0xfe, 0x1b, 0x00,
0x00, 0xff, 0xff, 0xdf, 0x01, 0xa0, 0x4b, 0x4a, 0x08, 0x00, 0x00,
// 993 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6e, 0xdb, 0x46,
0x10, 0x86, 0xac, 0xd8, 0xb2, 0x86, 0x92, 0x2c, 0x33, 0x4e, 0xb2, 0xf9, 0x71, 0x63, 0xcb, 0x71,
0xaa, 0x16, 0x45, 0x5a, 0xab, 0x79, 0x01, 0x59, 0x32, 0x5a, 0x01, 0x4d, 0x1b, 0x50, 0x0a, 0x7a,
0x2a, 0x88, 0x15, 0xb9, 0x96, 0x08, 0x91, 0x5c, 0x8a, 0xbb, 0x8c, 0xa1, 0x43, 0xfb, 0x20, 0x7d,
0x82, 0x3e, 0x66, 0xb1, 0x33, 0xfc, 0x53, 0x4e, 0x3d, 0xf4, 0xb6, 0xf3, 0xcd, 0x0c, 0x67, 0xe6,
0xe3, 0x37, 0x4b, 0x42, 0x7b, 0x29, 0xa3, 0x77, 0x49, 0x2a, 0xb5, 0xb4, 0x9b, 0x4b, 0x19, 0x0d,
0xbe, 0x87, 0xde, 0x38, 0xd3, 0x72, 0x9e, 0x64, 0x8e, 0xd8, 0x66, 0x42, 0x69, 0xfb, 0x1c, 0x60,
0x25, 0xa5, 0xaf, 0xdc, 0x98, 0x47, 0x82, 0x35, 0x2e, 0x1a, 0xc3, 0xb6, 0xd3, 0x46, 0xe4, 0x57,
0x1e, 0x89, 0x41, 0x00, 0x27, 0x65, 0x82, 0x4a, 0x64, 0xac, 0x84, 0xc9, 0x10, 0x69, 0x2a, 0x53,
0xd7, 0x93, 0x3e, 0x65, 0x1c, 0x3a, 0x6d, 0x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xd8, 0x04, 0x21, 0xfb, 0x0d, 0xf4, 0xca, 0x05,
0xa5, 0x02, 0x5f, 0xd3, 0x40, 0xc5, 0x96, 0x62, 0x85, 0x5a, 0xd4, 0x88, 0xa2, 0x86, 0x7b, 0x51,
0x23, 0x8c, 0x7a, 0x02, 0x47, 0x81, 0x72, 0x97, 0xd9, 0x8e, 0x7d, 0x43, 0xaa, 0x08, 0xd4, 0x6d,
0xb6, 0x33, 0xdc, 0xaf, 0x37, 0xee, 0xfe, 0xe7, 0xeb, 0x5b, 0xe2, 0x7e, 0xbd, 0x99, 0xd6, 0x3e,
0x60, 0xa3, 0x5b, 0x80, 0x5b, 0x19, 0xcd, 0x45, 0xfa, 0xd9, 0x28, 0xf6, 0x3d, 0xb4, 0xf2, 0x0f,
0xba, 0xfd, 0x18, 0xc5, 0xbd, 0xff, 0x3f, 0xf0, 0xe2, 0x6c, 0x1f, 0xa4, 0x6f, 0xc3, 0xf2, 0x08,
0xff, 0x21, 0x7e, 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xce, 0xfd, 0xa1, 0x50, 0x08, 0x00,
0x00,
}
......@@ -22,16 +22,18 @@ message AutoSpuResponse{
message RecommendRequest{
// @inject_tag: form:"goods_name"
string goods_name = 1;
// @inject_tag: form:"attrs"
string attrs = 2;
// @inject_tag: form:"encap"
string encap = 3;
// @inject_tag: form:"num"
int32 num = 2;
int32 num = 4;
// @inject_tag: form:"delivery_type"
int32 delivery_type = 3;
int32 delivery_type = 5;
// @inject_tag: form:"flag"
int32 flag = 4;
// @inject_tag: form:"p"
int32 p = 5;
// @inject_tag: form:"offset"
int32 offset = 6;
int32 flag = 6;
// @inject_tag: form:"brand_name"
string brand_name = 7;
}
message ResponseData{
......
......@@ -15,8 +15,7 @@ import (
)
//根据参数去匹配商品
func SearchAttr(attrOrigin string) (goodsName string, err error) {
//attrOrigin有可能是参数也可能是型号名称
func SearchAttr(attrOrigin, encap string) (goodsName string, err error) {
//先去切割参数得到参数列表
attrs := splitAttrs(attrOrigin)
var attrsSlice []string
......@@ -25,6 +24,17 @@ func SearchAttr(attrOrigin string) (goodsName string, err error) {
attr = TransformESParam(attr)
attrsSlice = append(attrsSlice, attr)
}
if encap != "" {
//先提取出纯数字
numberR, _ := regexp.Compile(common.PureNumberRegular)
pureNumber := numberR.FindString(encap)
//再去找对应属性
attrName, _ := redis.String(gredis.HGet("sku_map2", pureNumber))
if attrName != "" {
attrValue := attrName + "€" + pureNumber
attrsSlice = append(attrsSlice, attrValue)
}
}
query := getQuery(attrsSlice)
source := elastic.NewSearchSource().Query(query)
source.Sort("brand_sort", true)
......
......@@ -75,22 +75,25 @@ func getTermQuery(goodsName string) (query *elastic.BoolQuery) {
//推荐商品搜索
func Recommend(req *bom.RecommendRequest) (rsp *bom.ResponseData) {
var err error
//先去请求参数,看是否是参数,如果是参数的话,需要修改请求的商品名称
goodsNameByAttr, err := SearchAttr(req.GoodsName)
if goodsNameByAttr != "" {
req.GoodsName = goodsNameByAttr
var goodsName string
if req.GoodsName != "" {
goodsName, err = SearchAttr(req.GoodsName, req.Encap)
}
//如果没有型号,但是有参数(参数有可能是型号),那就去匹配参数
if req.GoodsName == "" && req.Attrs != "" {
goodsName, err = SearchAttr(req.Attrs, req.Encap)
}
if goodsName != "" {
req.GoodsName = goodsName
}
//转换请求参数
req = changeRecommendReq(req)
//获取需要请求的索引
index := getRecommendSearchIndex(req)
//是否是精确匹配
isRawSearch := false
if req.Flag == 3 {
isRawSearch = true
}
//获取es的请求参数
queryJson := getRecommendSearchParams(isRawSearch, req)
queryJson := getRecommendSearchParams(true, req)
result, err := es.CurlES(index, queryJson)
if err != nil {
log.Error(err)
......@@ -120,12 +123,6 @@ func changeRecommendReq(req *bom.RecommendRequest) (res *bom.RecommendRequest) {
if req.Num == 0 {
req.Num = 1
}
if req.P == 0 {
req.P = 1
}
if !(req.P > 1) {
req.Flag = 3
}
//转换处理商品名称
replace, _ := regexp.Compile("[^A-Za-z0-9]+")
req.GoodsName = replace.ReplaceAllString(req.GoodsName, "")
......
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