From 01f9fd779a0e85eb9be35522fcb5b3743bf62286 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Sun, 25 Nov 2007 10:03:18 -0600 Subject: [PATCH] fixes to scan Signed-off-by: Joshua Ferraro --- C4/Search.pm | 12 ++++++------ catalogue/search.pl | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index b06ad29ffa..05c27e5d30 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -287,8 +287,8 @@ sub getRecords { $query_to_use = $simple_query; } - $query_to_use = $simple_query if $scan; - + #$query_to_use = $simple_query if $scan; + #warn $simple_query if ($scan && $DEBUG); # check if we've got a query_type defined eval { if ($query_type) @@ -672,7 +672,7 @@ sub _build_weighted_query { # build the query itself sub buildQuery { - my ( $operators, $operands, $indexes, $limits, $sort_by ) = @_; + my ( $operators, $operands, $indexes, $limits, $sort_by, $scan) = @_; my @operators = @$operators if $operators; my @indexes = @$indexes if $indexes; @@ -732,7 +732,7 @@ sub buildQuery { # a flag to determine whether or not to add the index to the query my $indexes_set; # if the user is sophisticated enough to specify an index, turn off some defaults - if ($operands[$i] =~ /(:|=)/) { + if ($operands[$i] =~ /(:|=)/ || $scan) { $weight_fields = 0; $stemming = 0; $remove_stopwords = 0; @@ -876,6 +876,8 @@ sub buildQuery { $limit.="$availability_limit"; } # normalize the strings + $query =~ s/:/=/g; + $limit =~ s/:/=/g; for ($query, $query_desc, $limit, $limit_desc) { $_ =~ s/ / /g; # remove extra spaces $_ =~ s/^ //g; # remove any beginning spaces @@ -883,8 +885,6 @@ sub buildQuery { $_ =~ s/==/=/g; # remove double == from query } - $query =~ s/:/=/g; - $limit =~ s/:/=/g; $query_cgi =~ s/^&//; # append the limit to the query diff --git a/catalogue/search.pl b/catalogue/search.pl index 75485e378d..386db2278b 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -400,7 +400,7 @@ my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit my @results; ## I. BUILD THE QUERY -( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by); +( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by,$scan); ## parse the query_cgi string and put it into a form suitable for s my @query_inputs; -- 2.39.5