Protect search against all-deleted bibs by pinning the estimation ratios in that...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 13 Apr 2011 16:15:11 +0000 (16:15 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 13 Apr 2011 16:15:11 +0000 (16:15 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@20069 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm

index 3c7c06a..a2cc36b 100644 (file)
@@ -2657,10 +2657,10 @@ sub FTS_paging_estimate {
     my $delete_adjusted_total = $total - ( $total * $deleted_ratio );
 
     my $exclusion_ratio = $excluded / $checked;
-    my $delete_adjusted_exclusion_ratio = $excluded / ($checked - $deleted);
+    my $delete_adjusted_exclusion_ratio = $checked - $deleted ? $excluded / ($checked - $deleted) : 1;
 
     my $inclusion_ratio = $visible / $checked;
-    my $delete_adjusted_inclusion_ratio = $visible / ($checked - $deleted);
+    my $delete_adjusted_inclusion_ratio = $checked - $deleted ? $visible / ($checked - $deleted) : 0;
 
     return {
         exclusion                   => int($delete_adjusted_total - ( $delete_adjusted_total * $exclusion_ratio )),