redis-om-python icon indicating copy to clipboard operation
redis-om-python copied to clipboard

Fix: Pagination to consider limit value while returning response.

Open iamvishalkhare opened this issue 3 years ago • 1 comments

Pagination fix

Problem? Often times in production we don't want to return all matching records instead returning a paginated response based on values of limit and offset is desirable.

What is being fixed? Even after setting a limit value it was not working and .all() or .execute() function were returning complete set of records matching the search criterion.

How is it fixed? To break away from loop executing the query a condition is added wherein if total number of fetched records is equal or greater than limit.

NOTE: If no limit is provided, default value i.e. 10 records will be returned. Returning all records is usually a bad idea. Take Elasticsearch or Apache solr for example where if you don't provide a limit, by default only 10 records are returned.

iamvishalkhare avatar Jun 25 '22 14:06 iamvishalkhare

@simonprickett - Any input will be appreciated

iamvishalkhare avatar Jun 25 '22 15:06 iamvishalkhare