Skip to content

Commit

Permalink
include * on suffix query across all engines (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipecosta90 authored Sep 30, 2022
1 parent 4c22de7 commit 13cb71e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func SuffixBenchmark(terms []string, field string, idx index.Index, prefixMinLen
counter++
term = terms[counter%len(terms)]
}
term = term[len(term)-int(prefixSize):]
term = "*" + term[len(term)-int(prefixSize):]
q := query.NewQuery(idx.GetName(), term).Limit(0, 5).SetFlags(query.QueryTypeSuffix).SetField(field)
_, _, err := idx.SuffixQuery(*q, debug)
counter++
Expand Down
3 changes: 0 additions & 3 deletions index/redisearch/redisearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ func (i *Index) FullTextQuerySingleField(q query.Query, verbose int) (docs []ind
if q.Flags&query.QueryTypePrefix != 0 && term[len(term)-1] != '*' {
term = fmt.Sprintf("%s*", term)
}
if q.Flags&query.QueryTypeSuffix != 0 && term[0] != '*' {
term = fmt.Sprintf("*%s", term)
}
queryParam := term
if q.Field != "" {
queryParam = fmt.Sprintf("@%s:%s", q.Field, term)
Expand Down

0 comments on commit 13cb71e

Please sign in to comment.