[open-ils-commits] r10861 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Search

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Oct 17 11:28:13 EDT 2008


Author: erickson
Date: 2008-10-17 11:28:11 -0400 (Fri, 17 Oct 2008)
New Revision: 10861

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Log:
if we have loaded all search results, don't bother estimating the hit count since we know the real hit count already

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm	2008-10-17 15:16:18 UTC (rev 10860)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm	2008-10-17 15:28:11 UTC (rev 10861)
@@ -800,6 +800,7 @@
     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++) {
 
@@ -879,6 +880,8 @@
         # we've scanned all possible hits
         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;
         }
     }
@@ -886,7 +889,7 @@
     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 {



More information about the open-ils-commits mailing list