[open-ils-commits] r10862 - in branches/acq-experiment: . Open-ILS/src/perlmods/OpenILS/Application/Search

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Oct 17 12:08:17 EDT 2008


Author: erickson
Date: 2008-10-17 12:08:14 -0400 (Fri, 17 Oct 2008)
New Revision: 10862

Modified:
   branches/acq-experiment/
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Log:
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
........



Property changes on: branches/acq-experiment
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk:1-10855
   + /trunk:1-10861

Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm	2008-10-17 15:28:11 UTC (rev 10861)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm	2008-10-17 16:08:14 UTC (rev 10862)
@@ -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++) {
 
@@ -877,13 +878,18 @@
         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 {



More information about the open-ils-commits mailing list