From 4b985fc82f0c5a00dd8b3fab53b6b7be075b5704 Mon Sep 17 00:00:00 2001 From: gyula Date: Sun, 16 Oct 2022 23:23:59 +0200 Subject: [PATCH] fixing total count --- redisearch/aggregate.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/redisearch/aggregate.go b/redisearch/aggregate.go index bdda4c5..61a4a66 100644 --- a/redisearch/aggregate.go +++ b/redisearch/aggregate.go @@ -2,9 +2,10 @@ package redisearch import ( "fmt" - "github.com/gomodule/redigo/redis" "log" "reflect" + + "github.com/gomodule/redigo/redis" ) // Projection - Apply a 1-to-1 transformation on one or more properties, @@ -319,7 +320,10 @@ func processAggQueryReply(res []interface{}) (total int, aggregateReply []map[st total = 0 aggregateResults := len(res) - 1 if aggregateResults > 0 { - total = aggregateResults + t, ok := res[0].(int64) + if ok { + total = int(t) + } aggregateReply = make([]map[string]interface{}, aggregateResults) for i := 0; i < aggregateResults; i++ { if d, e := mapToStrings(res[i+1], nil); e == nil {