Closed xjplke closed 2 years ago
@xjplke it shouldn't be total since total represent the total amount of results while the actual amount of results can be limited by LIMIT
, but it seems like the right code should be:
docs = make([]Document, 0, len(res)/2)
@xjplke it shouldn't be total since total represent the total amount of results while the actual amount of results can be limited by
LIMIT
, but it seems like the right code should be:docs = make([]Document, 0, len(res)/2)
Yes, you are right. I missed the impact of LIMIT.
https://github.com/RediSearch/redisearch-go/blob/7a5af817fbc0755cc59c366e487c7a480788b963/redisearch/client.go#L115 The cap of Document slice returned by the search method should be the variable total.
This does not result in serious errors.
But I think len(res)-1 is not in line with the programmer's intention.