In a site with a lot of cases, a good number of them were missing on the pivot reports.
Issue
On looking into the code, getPaginatedResults() checks for previous index name and if its the same it increments the page number and if the index is different it resets page number to 0. However in certain cases there are indexes which are not sequential but have the same index name. In such cases the page number is wrongly set to 0 and the old page entities are missed.
Resolution
Maintain an array of index names and page numbers instead of a single index name.
Overview
In a site with a lot of cases, a good number of them were missing on the pivot reports.
Issue
On looking into the code, getPaginatedResults() checks for previous index name and if its the same it increments the page number and if the index is different it resets page number to 0. However in certain cases there are indexes which are not sequential but have the same index name. In such cases the page number is wrongly set to 0 and the old page entities are missed.
Resolution
Maintain an array of index names and page numbers instead of a single index name.