From 55af6e488e53f64f1e37370b5c9248b753de7160 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 17 Oct 2008 16:08:14 +0000 Subject: [PATCH] Merged revisions 10860-10861 via svnmerge from svn://svn.open-ils.org/ILS/trunk ........ r10860 | erickson | 2008-10-17 11:16:18 -0400 (Fri, 17 Oct 2008) | 1 line after all search results scanned, we know the exact hit count, so use that instead of the estimated count ........ r10861 | erickson | 2008-10-17 11:28:11 -0400 (Fri, 17 Oct 2008) | 1 line if we have loaded all search results, don't bother estimating the hit count since we know the real hit count already ........ git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@10862 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index d2b838e191..13432e3647 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -800,6 +800,7 @@ sub staged_search { my $est_hit_count = 0; my $current_page_summary = {}; my $global_summary = {checked => 0, visible => 0, excluded => 0, deleted => 0, total => 0}; + my $is_real_hit_count = 0; for($page = 0; $page < $max_superpages; $page++) { @@ -877,13 +878,18 @@ sub staged_search { last if $current_count >= ($user_limit + $user_offset); # we've scanned all possible hits - last if $summary->{checked} < $superpage_size; + if($summary->{checked} < $superpage_size) { + $est_hit_count = scalar(@$all_results); + # we have all possible results in hand, so we know the final hit count + $is_real_hit_count = 1; + last; + } } my @results = grep {defined $_} @$all_results[$user_offset..($user_offset + $user_limit - 1)]; # refine the estimate if we have more than one superpage - if ($page > 0) { + if ($page > 0 and not $is_real_hit_count) { if ($global_summary->{checked} >= $global_summary->{total}) { $est_hit_count = $global_summary->{visible}; } else { -- 2.11.0