From e4f6ccf522351f4210011c4719170c52eac9662b Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 27 Mar 2014 17:38:34 +0100 Subject: [PATCH] Bug 9368 - do not change if QueryParser --- C4/Search.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 2011acf..f3f3daf 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1273,6 +1273,8 @@ sub buildQuery { my $fuzzy_enabled = C4::Context->preference("QueryFuzzy") || 0; my $remove_stopwords = C4::Context->preference("QueryRemoveStopwords") || 0; + my $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser')); + my $query = $operands[0]; my $simple_query = $operands[0]; @@ -1367,14 +1369,24 @@ sub buildQuery { # Add index-specific attributes # Date of Publication if ( $index eq 'yr' ) { - $operand = "$index,st-numeric=$operand"; + if ($QParser) { + $index .= ",st-numeric"; + } + else { + $operand = "$index,st-numeric=$operand"; + } $indexes_set++; $stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0; } # Date of Acquisition elsif ( $index eq 'acqdate' ) { - $operand = "$index,st-date-normalized=$operand"; + if ($QParser) { + $index .= ",st-date-normalized"; + } + else { + $operand = "$index,st-date-normalized=$operand"; + } $indexes_set++; $stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0; } -- 1.8.3.2