Issue 2551264
Created on 2023-02-23 19:55 by rouilj, last changed 2024-04-08 15:42 by rouilj.
msg7729 |
Author: [hidden] (rouilj) |
Date: 2023-02-23 19:55 |
|
When using paging with rest, the X-Total-Count header and the in json @total_size
properties match the returned content. It should match all the items returned
before pagination.
That info isn't directly available at the rest.py level. The pagination is pushed
down into the database via the filter method. In the rdbms db at least we use OFFSET
and LIMIT in the db query, so the full list of matching items isn't available.
Maybe change docs to remove X-Total-Count header? Returned @total_size to @returned_size
or something similar. Might be able to estimate this number but performing a count()
at the db level might be possible but is the run time worth it?
|
msg7970 |
Author: [hidden] (rouilj) |
Date: 2024-03-30 07:26 |
|
Closing this in favor of the solution outlined in issue 2551328.
The solution fixes the total count if there are fewer than 10 million results found.
If more than 10M results are found, @total_size and the header are set to -1.
|
msg7983 |
Author: [hidden] (rouilj) |
Date: 2024-04-08 15:42 |
|
My statement about the accuracy of @total_size wasn't correct. @total_size is
the count of returned records prior to filtering for View permission.
So @total_size is >= the number of records the user can see.
But the current 'fix' that possibly overcounts is better than what was originally
happening.
|
|
Date |
User |
Action |
Args |
2024-04-08 15:42:14 | rouilj | set | messages:
+ msg7983 |
2024-03-30 07:26:56 | rouilj | set | status: new -> closed superseder: REST has @links[next] link if the number of items is a multiple of @page_size resolution: duplicate messages:
+ msg7970 |
2023-02-28 00:28:59 | rouilj | set | title: REST X-Total-Count header and @total_size count returned not matching when paginated -> REST X-Total-Count header and @total_size count incorrect when paginated |
2023-02-23 19:55:34 | rouilj | create | |
|