mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
* fix (#3220) * LOAD has NO AS param(https://redis.io/docs/latest/commands/ft.aggregate/) * fix typo: WITHCOUT -> WITHCOUNT * fix (#3220): * Compatible with known RediSearch issue in test * fix (#3220) * fixed the calculation bug of the count of load params * test should not include special condition * return errors when they occur --------- Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com> Co-authored-by: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com>
This commit is contained in:
@ -269,6 +269,8 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(res1.Total).To(BeEquivalentTo(int64(1)))
|
||||
|
||||
_, err = client.FTSearch(ctx, "idx_not_exist", "only in the body").Result()
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
|
||||
It("should FTSpellCheck", Label("search", "ftcreate", "ftsearch", "ftspellcheck"), func() {
|
||||
@ -643,11 +645,25 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(res.Rows[0].Fields["t2"]).To(BeEquivalentTo("world"))
|
||||
|
||||
options = &redis.FTAggregateOptions{Load: []redis.FTAggregateLoad{{Field: "t2", As: "t2alias"}}}
|
||||
res, err = client.FTAggregateWithArgs(ctx, "idx1", "*", options).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(res.Rows[0].Fields["t2alias"]).To(BeEquivalentTo("world"))
|
||||
|
||||
options = &redis.FTAggregateOptions{Load: []redis.FTAggregateLoad{{Field: "t1"}, {Field: "t2", As: "t2alias"}}}
|
||||
res, err = client.FTAggregateWithArgs(ctx, "idx1", "*", options).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(res.Rows[0].Fields["t1"]).To(BeEquivalentTo("hello"))
|
||||
Expect(res.Rows[0].Fields["t2alias"]).To(BeEquivalentTo("world"))
|
||||
|
||||
options = &redis.FTAggregateOptions{LoadAll: true}
|
||||
res, err = client.FTAggregateWithArgs(ctx, "idx1", "*", options).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(res.Rows[0].Fields["t1"]).To(BeEquivalentTo("hello"))
|
||||
Expect(res.Rows[0].Fields["t2"]).To(BeEquivalentTo("world"))
|
||||
|
||||
_, err = client.FTAggregateWithArgs(ctx, "idx_not_exist", "*", &redis.FTAggregateOptions{}).Result()
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
|
||||
It("should FTAggregate with scorer and addscores", Label("search", "ftaggregate", "NonRedisEnterprise"), func() {
|
||||
@ -1268,6 +1284,7 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
|
||||
val, err = client.FTCreate(ctx, "idx_hash", ftCreateOptions, schema...).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(val).To(Equal("OK"))
|
||||
WaitForIndexing(client, "idx_hash")
|
||||
|
||||
ftSearchOptions := &redis.FTSearchOptions{
|
||||
DialectVersion: 4,
|
||||
|
Reference in New Issue
Block a user