From 43f45dfbcfc5a79fee1607fdaf1a29f36d7e4840 Mon Sep 17 00:00:00 2001
From: Fridolyn SOMERS <fridolyn.somers@biblibre.com>
Date: Tue, 8 Jan 2013 18:03:37 +0100
Subject: [PATCH] Bug 9368: specific behavior of yr and acqdate indexes

When searching on the date of publication or date of acquisition
indexes from advanced search, there are several bugs :

- The search is performed on specific index, using only search term.
- The next or previous pages lead to an empty result page.

This comes from specific behavior in C4/Search.pm, $indexes_set flag
is used but the index is not added to the operand.

This patch corrects this.

Test plan :

- Go to advanced search in the staff interface
- Select publication date or acquisition date
- Enter a valid search term (you must have several pages of results)
- Click on search
  => result page shows a correct result number
- Click on page 2
  => next results are shown

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
---
 C4/Search.pm |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index 50f7d2b..376f0e8 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -1313,14 +1313,14 @@ sub buildQuery {
                 # Add index-specific attributes
                 # Date of Publication
                 if ( $index eq 'yr' ) {
-                    $index .= ",st-numeric";
+                    $operand = "$index,st-numeric=$operand";
                     $indexes_set++;
 					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
                 }
 
                 # Date of Acquisition
                 elsif ( $index eq 'acqdate' ) {
-                    $index .= ",st-date-normalized";
+                    $operand = "$index,st-date-normalized=$operand";
                     $indexes_set++;
 					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
                 }
-- 
1.7.2.5