@@ -76,9 +76,10 @@ $Collection->RowsPerPage( $Rows ) if $Rows;
7676$Page = 1 unless $Page && $Page =~ /\A\d+\z/ && $Page > 1; # workaround problems with $Page = '' or undef
7777$Collection->GotoPage( $Page - 1 ); # SB uses page 0 as the first page
7878
79- # $Collection might not have CombineSearchAndCount method, like dashboards and saved searches.
80- # Don't combine search and count for unpaginated searches, as we will progressively generate the result.
81- $Collection->CombineSearchAndCount(1) if $Rows && $Collection->can('CombineSearchAndCount');
79+ # For unpaginated searches we progressively generate the result in chunks of
80+ # $ProgressiveSearchResultRows rows, and must not combine search and count then.
81+ my $ProgressiveRows = $Rows ? 0 : RT->Config->Get('ProgressiveSearchResultRows');
82+ $Collection->CombineSearchAndCount(1) unless $ProgressiveRows;
8283$TotalFound = $Collection->CountAll() unless defined $TotalFound;
8384return '' if !$TotalFound && !$ShowEmpty;
8485
@@ -159,11 +160,9 @@ if ( $ShowHeader ) {
159160
160161my ($i, $column_map) = (0, {});
161162$m->out('<tbody>');
162- if ( !$Rows ) {
163- $Collection->RowsPerPage(100);
164- }
163+ $Collection->RowsPerPage($ProgressiveRows) if $ProgressiveRows;
165164
166- while ( my $record = $Rows ? $Collection->Next : ( $Collection->Next || ( $Collection->NextPage && $Collection->Next ) ) ) {
165+ while ( my $record = $ProgressiveRows ? ( $Collection->Next || ( $Collection->NextPage && $Collection->Next ) ) : $Collection->Next ) {
167166 # Every ten rows, flush the buffer and put something on the page.
168167 $m->flush_buffer unless ++$i % 10;
169168
0 commit comments