Skip to content

Commit 13cb71e

Browse files
include * on suffix query across all engines (#21)
1 parent 4c22de7 commit 13cb71e

2 files changed

Lines changed: 1 addition & 4 deletions

File tree

benchmark.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func SuffixBenchmark(terms []string, field string, idx index.Index, prefixMinLen
4747
counter++
4848
term = terms[counter%len(terms)]
4949
}
50-
term = term[len(term)-int(prefixSize):]
50+
term = "*" + term[len(term)-int(prefixSize):]
5151
q := query.NewQuery(idx.GetName(), term).Limit(0, 5).SetFlags(query.QueryTypeSuffix).SetField(field)
5252
_, _, err := idx.SuffixQuery(*q, debug)
5353
counter++

index/redisearch/redisearch.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,6 @@ func (i *Index) FullTextQuerySingleField(q query.Query, verbose int) (docs []ind
221221
if q.Flags&query.QueryTypePrefix != 0 && term[len(term)-1] != '*' {
222222
term = fmt.Sprintf("%s*", term)
223223
}
224-
if q.Flags&query.QueryTypeSuffix != 0 && term[0] != '*' {
225-
term = fmt.Sprintf("*%s", term)
226-
}
227224
queryParam := term
228225
if q.Field != "" {
229226
queryParam = fmt.Sprintf("@%s:%s", q.Field, term)

0 commit comments

Comments
 (0)