Commit 92478a76 by huangchengyi

1.0

parent 7250594f
Showing with 8 additions and 2 deletions
......@@ -4,9 +4,11 @@ import (
"errors"
"github.com/gin-gonic/gin"
"gopkg.in/olivere/elastic.v5"
"regexp"
"search_server/pkg/common"
"search_server/pkg/config"
"search_server/pkg/gredis"
"strings"
)
/*
......@@ -31,8 +33,12 @@ func GetOptimumAttrQuery(ctx *gin.Context,REQUEST_ATTR *map[string][]string,type
if ctx.Request.FormValue("avail_rank") == "1" { //只显示有货
query.Must(elastic.NewRangeQuery("stock").Gt(0))
}
if ctx.Request.FormValue("goods_name/condition") != "" { //型号搜索
query.Must(elastic.NewTermQuery("goods_name",ctx.Request.FormValue("goods_name/condition")))
goods_name := ctx.Request.FormValue("goods_name/condition")
if goods_name != "" { //型号搜索
replace, _ := regexp.Compile("[^A-Za-z0-9]+")
goods_name = replace.ReplaceAllString(goods_name, "")
goods_name = strings.ToUpper(goods_name)
query.Must(elastic.NewTermQuery("goods_name",goods_name))
}
//存在属性查询
......
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