Skip to content

Commit 053c94c

Browse files
Cgol9Christopher Golling
authored andcommitted
SortByWithCount FTSearchOptions fix (#3201)
* SortByWithCount FTSearchOptions fix * FTSearch test fix * Another FTSearch test fix * Another FTSearch test fix --------- Co-authored-by: Christopher Golling <[email protected]>
1 parent 379c1ab commit 053c94c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

search_commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ func FTSearchQuery(query string, options *FTSearchOptions) SearchQuery {
17751775
}
17761776
}
17771777
if options.SortByWithCount {
1778-
queryArgs = append(queryArgs, "WITHCOUT")
1778+
queryArgs = append(queryArgs, "WITHCOUNT")
17791779
}
17801780
}
17811781
if options.LimitOffset >= 0 && options.Limit > 0 {

search_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
125125
Expect(res2.Docs[1].ID).To(BeEquivalentTo("doc2"))
126126
Expect(res2.Docs[0].ID).To(BeEquivalentTo("doc3"))
127127

128+
res3, err := client.FTSearchWithArgs(ctx, "num", "foo", &redis.FTSearchOptions{NoContent: true, SortBy: []redis.FTSearchSortBy{sortBy2}, SortByWithCount: true}).Result()
129+
Expect(err).NotTo(HaveOccurred())
130+
Expect(res3.Total).To(BeEquivalentTo(int64(0)))
131+
128132
})
129133

130134
It("should FTCreate and FTSearch example", Label("search", "ftcreate", "ftsearch"), func() {

0 commit comments

Comments
 (0)