feat:优化es查询规则

This commit is contained in:
henry
2021-12-24 09:13:16 +08:00
parent b62ee9c3d9
commit ebf74435ef
5 changed files with 39 additions and 55 deletions

View File

@ -34,15 +34,15 @@ func (this *ESManage) Create() error {
}
func (this *ESManage) Search(page, pageSize int) (interface{}, error) {
mustParams := make(map[string]interface{}, 0)
termParams := make(map[string]interface{}, 0)
shouldParams := make(map[string]interface{}, 0)
if this.Industry != "" {
termParams["industry"] = this.Industry
}
if this.Title != "" {
shouldParams["title"] = this.Title
}
if this.Industry != "" {
mustParams["title"] = this.Industry
}
if this.Keyword != "" {
shouldParams["keyword"] = this.Keyword
}
@ -50,7 +50,7 @@ func (this *ESManage) Search(page, pageSize int) (interface{}, error) {
shouldParams["research"] = this.Research
}
out, err := es.Search(this, this.Index(), &es.SearchParams{
MustParams: mustParams,
TermParams: termParams,
ShouldParams: shouldParams,
}, page, pageSize)