Commit 420650aa by mushishixian

去掉分数排序

parent 33b6c8dd
Showing with 5 additions and 4 deletions
......@@ -6,6 +6,7 @@ import (
"bom_server/internal/model"
"context"
"encoding/json"
"fmt"
es "gopkg.in/olivere/elastic.v5"
"regexp"
"strings"
......@@ -88,21 +89,21 @@ func getSearchParams(index string, bomItem model.BomItem, sort int, flag bool) (
query := getTermQuery(bomItem, sort, flag)
source := es.NewSearchSource().Query(query)
if sort == 1 {
source.Sort("_score", false)
//source.Sort("_score", false)
source.Sort("moq", true)
}
//要去判断sort,sort=2是按照价格(价格有问题,目前按起订量)排序
if sort == 2 {
source.Sort("_score", false)
//source.Sort("_score", false)
source.Sort("moq", true)
//sort=3是按照库存排序
} else if sort == 3 {
source.Sort("_score", false)
//source.Sort("_score", false)
source.Sort("stock", false)
}
source = source.From(0).Size(1)
searchRequest = es.NewSearchRequest().Source(source)
//fmt.Println(searchRequest.Body())
fmt.Println(searchRequest.Body())
return searchRequest
}
......
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