@@ -574,11 +574,8 @@ func FTAggregateQuery(query string, options *FTAggregateOptions) AggregateQuery
574574		if  options .SortByMax  >  0  {
575575			queryArgs  =  append (queryArgs , "MAX" , options .SortByMax )
576576		}
577- 		if  options .LimitOffset  >  0  {
578- 			queryArgs  =  append (queryArgs , "LIMIT" , options .LimitOffset )
579- 		}
580- 		if  options .Limit  >  0  {
581- 			queryArgs  =  append (queryArgs , options .Limit )
577+ 		if  options .LimitOffset  >=  0  &&  options .Limit  >  0  {
578+ 			queryArgs  =  append (queryArgs , "LIMIT" , options .LimitOffset , options .Limit )
582579		}
583580		if  options .Filter  !=  ""  {
584581			queryArgs  =  append (queryArgs , "FILTER" , options .Filter )
@@ -773,11 +770,8 @@ func (c cmdable) FTAggregateWithArgs(ctx context.Context, index string, query st
773770		if  options .SortByMax  >  0  {
774771			args  =  append (args , "MAX" , options .SortByMax )
775772		}
776- 		if  options .LimitOffset  >  0  {
777- 			args  =  append (args , "LIMIT" , options .LimitOffset )
778- 		}
779- 		if  options .Limit  >  0  {
780- 			args  =  append (args , options .Limit )
773+ 		if  options .LimitOffset  >=  0  &&  options .Limit  >  0  {
774+ 			args  =  append (args , "LIMIT" , options .LimitOffset , options .Limit )
781775		}
782776		if  options .Filter  !=  ""  {
783777			args  =  append (args , "FILTER" , options .Filter )
0 commit comments