[open-ils-commits] r10320 - in trunk/Open-ILS/src:
perlmods/OpenILS/Application/Search
perlmods/OpenILS/Application/Storage/Publisher sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Aug 10 01:34:57 EDT 2008
Author: miker
Date: 2008-08-10 01:34:55 -0400 (Sun, 10 Aug 2008)
New Revision: 10320
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
Log:
more staged search configurability and acuracy
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2008-08-10 03:49:21 UTC (rev 10319)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2008-08-10 05:34:55 UTC (rev 10320)
@@ -781,11 +781,12 @@
$search_hash->{core_limit} = $superpage_size * $max_superpages;
# Set the configured estimation strategy, defaults to 'inclusion'.
- $search_hash->{estimation_strategy} = OpenSRF::Utils::SettingsClient
+ my $estimation_strategy = OpenSRF::Utils::SettingsClient
->new
->config_value(
apps => 'open-ils.search', app_settings => 'estimation_strategy'
- );
+ ) || 'inclusion';
+ $search_hash->{estimation_strategy} = $estimation_strategy;
# pull any existing results from the cache
my $key = search_cache_key($method, $search_hash);
@@ -797,6 +798,7 @@
my $page; # current superpage
my $est_hit_count = 0;
my $current_page_summary = {};
+ my $global_summary = {checked => 0, visible => 0, excluded => 0, deleted => 0, total => 0};
for($page = 0; $page < $max_superpages; $page++) {
@@ -845,6 +847,14 @@
$logger->debug("staged search: located $current_count, with estimated hits=".
$summary->{estimated_hit_count}." : visible=".$summary->{visible}.", checked=".$summary->{checked});
+ if (defined($summary->{estimated_hit_count})) {
+ $global_summary->{checked} += $summary->{checked};
+ $global_summary->{visible} += $summary->{visible};
+ $global_summary->{excluded} += $summary->{excluded};
+ $global_summary->{deleted} += $summary->{deleted};
+ $global_summary->{total} = $summary->{total};
+ }
+
# we've found all the possible hits
last if $current_count == $summary->{visible}
and not defined $summary->{estimated_hit_count};
@@ -858,6 +868,23 @@
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 ($global_summary->{checked} >= $global_summary->{total}) {
+ $est_hit_count = $global_summary->{visible};
+ } else {
+ my $updated_hit_count = $U->storagereq(
+ 'open-ils.storage.fts_paging_estimate',
+ $global_summary->{checked},
+ $global_summary->{visible},
+ $global_summary->{excluded},
+ $global_summary->{deleted},
+ $global_summary->{total}
+ );
+ $est_hit_count = $updated_hit_count->{$estimation_strategy};
+ }
+ }
+
return {
count => $est_hit_count,
core_limit => $search_hash->{core_limit},
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm 2008-08-10 03:49:21 UTC (rev 10319)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm 2008-08-10 05:34:55 UTC (rev 10320)
@@ -2652,7 +2652,7 @@
}
__PACKAGE__->register_method(
api_name => "open-ils.storage.fts_paging_estimate",
- method => 'staged_fts',
+ method => 'FTS_paging_estimate',
argc => 5,
strict => 1,
api_level => 1,
Modified: trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql 2008-08-10 03:49:21 UTC (rev 10319)
+++ trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql 2008-08-10 05:34:55 UTC (rev 10320)
@@ -258,7 +258,7 @@
tmp_text := '999999';
IF param_sort_desc THEN tmp_text := '0'; END IF;
- current_rank := $$ COALESCE( mrd.date1, $$ || quote_literal(tmp_text) || $$ )::INT ) $$;
+ current_rank := $$ COALESCE( FIRST(NULLIF(REGEXP_REPLACE(mrd.date1, E'\\D+', '9', 'g'),'')), $$ || quote_literal(tmp_text) || $$ )::INT $$;
ELSIF param_sort = 'title' THEN
More information about the open-ils-commits
mailing list