File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed
Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 11package paginations
22
33import (
4+ "fmt"
5+
46 configs "github.com/crowdeco/skeleton/configs"
57 events "github.com/crowdeco/skeleton/events"
68 handlers "github.com/crowdeco/skeleton/handlers"
@@ -16,7 +18,9 @@ func (u *Filter) Handle(event interface{}) {
1618 filters := e .Filters
1719
1820 for _ , v := range filters {
19- query .Must (elastic .NewMatchQuery (v .Field , v .Value ))
21+ q := elastic .NewWildcardQuery (v .Field , fmt .Sprintf ("*%s*" , v .Value ))
22+ q .Boost (1.0 )
23+ query .Must (q )
2024 }
2125}
2226
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ func (es *ElasticsearchAdapter) Nums() (int64, error) {
4242 return result .TotalHits (), nil
4343}
4444
45- func (es * ElasticsearchAdapter ) Slice (offset , length int , data interface {}) error {
45+ func (es * ElasticsearchAdapter ) Slice (offset int , length int , data interface {}) error {
4646 es .pageQuery .Must (elastic .NewRangeQuery ("Counter" ).From (offset ).To (length + offset ))
4747
4848 result , err := es .client .Search ().Index (es .index ).IgnoreUnavailable (true ).Query (es .pageQuery ).Size (length ).Do (es .context )
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ func (p *Pagination) Handle(pagination *grpcs.Pagination) {
4141 pagination .Limit = 17
4242 }
4343
44+ p .Filters = nil
4445 if len (pagination .Fields ) == len (pagination .Values ) {
4546 for k , v := range pagination .Fields {
4647 if v != "" {
You can’t perform that action at this time.
0 commit comments