From 7761867f383f5e47403f8a64009cbaac42e12b80 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Tue, 20 Nov 2007 21:02:13 -0600 Subject: [PATCH] adding $simple_search for index scanning and federated queries Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Search.pm | 15 ++++++++------- catalogue/search.pl | 10 ++++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index a53cadf785..688d0782df 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -252,7 +252,7 @@ sub SimpleSearch { # performs the search sub getRecords { my ( - $koha_query, $federated_query, $sort_by_ref, + $koha_query, $simple_query, $sort_by_ref, $servers_ref, $results_per_page, $offset, $expanded_facet, $branches, $query_type, $scan @@ -284,9 +284,11 @@ sub getRecords { $query_to_use = $koha_query; } else { - $query_to_use = $federated_query; + $query_to_use = $simple_query; } + $query_to_use = $simple_query if $scan; + # check if we've got a query_type defined eval { if ($query_type) @@ -318,15 +320,13 @@ sub getRecords { } else { if ($scan) { - - # warn "preparing to scan"; + warn "preparing to scan:$query_to_use"; $results[$i] = $zconns[$i]->scan( new ZOOM::Query::CCL2RPN( $query_to_use, $zconns[$i] ) ); } else { - # warn "LAST : $query_to_use"; $results[$i] = $zconns[$i]->search( @@ -679,6 +679,7 @@ sub buildQuery { my $fuzzy_enabled = C4::Context->preference("QueryFuzzy") || 0; my $query = $operands[0]; + my $simple_query = $operands[0]; my $query_cgi; my $query_search_desc; @@ -855,7 +856,7 @@ sub buildQuery { warn "LIMIT CGI:".$limit_cgi if $DEBUG; warn "LIMIT DESC:".$limit_desc if $DEBUG; - return ( undef, $query,$query_cgi,$query_search_desc,$limit,$limit_cgi,$limit_desc ); + return ( undef, $query,$simple_query,$query_cgi,$query_search_desc,$limit,$limit_cgi,$limit_desc ); } # IMO this subroutine is pretty messy still -- it's responsible for @@ -1105,7 +1106,7 @@ sub searchResults { sub NZgetRecords { my ( - $koha_query, $federated_query, $sort_by_ref, + $koha_query, $simple_query, $sort_by_ref, $servers_ref, $results_per_page, $offset, $expanded_facet, $branches, $query_type, $scan diff --git a/catalogue/search.pl b/catalogue/search.pl index 87aab37dae..0dd0b4ae11 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -381,6 +381,8 @@ foreach my $limit(@limits) { } } $template->param(available => $available); + +# append year limits if they exist push @limits, map "yr:".$_, split("\0",$params->{'limit-yr'}) if $params->{'limit-yr'}; # Params that can only have one value @@ -392,12 +394,12 @@ my $hits; my $expanded_facet = $params->{'expand'}; # Define some global variables -my ( $error,$query,$query_cgi,$query_search_desc,$limit,$limit_cgi,$limit_desc,$query_type); +my ( $error,$query,$simple_query,$query_cgi,$query_search_desc,$limit,$limit_cgi,$limit_desc,$query_type); my @results; ## I. BUILD THE QUERY -( $error,$query,$query_cgi,$query_search_desc,$limit,$limit_cgi,$limit_desc,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by); +( $error,$query,$simple_query,$query_cgi,$query_search_desc,$limit,$limit_cgi,$limit_desc,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by); ## II. DO THE SEARCH AND GET THE RESULTS my $total; # the total results for the whole set @@ -407,11 +409,11 @@ my $results_hashref; if (C4::Context->preference('NoZebra')) { eval { - ($error, $results_hashref, $facets) = NZgetRecords($query,$query_cgi,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan); + ($error, $results_hashref, $facets) = NZgetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan); }; } else { eval { - ($error, $results_hashref, $facets) = getRecords($query,$query_cgi,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan); + ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan); }; } if ($@ || $error) { -- 2.39.5