[Koha-patches] [PATCH] Fixes 2 search problems : Please Test

Henri-Damien LAURENT henridamien at koha-fr.org
Mon May 19 17:54:41 CEST 2008


indexes_set was set on yr and date searches.
This lead to search date string in all the fields (index was forgotten)

If limit was null string, it still added "and".
This caused some searches not to work because there were no parameters.
---
 C4/Search.pm |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index 8dcfe4b..f34de07 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -934,19 +934,19 @@ sub buildQuery {
                 # Date of Publication
                 if ( $index eq 'yr' ) {
                     $index .= ",st-numeric";
-                    $indexes_set++;
+#                     $indexes_set++;
 					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
                 }
 
                 # Date of Acquisition
                 elsif ( $index eq 'acqdate' ) {
                     $index .= ",st-date-normalized";
-                    $indexes_set++;
+#                     $indexes_set++;
 					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
                 }
                 # ISBN,ISSN,Standard Number, don't need special treatment
                 elsif ( $index eq 'nb' || $index eq 'ns' ) {
-                    $indexes_set++;
+#                     $indexes_set++;
                     (   
                         $stemming,      $auto_truncation,
                         $weight_fields, $fuzzy_enabled,
@@ -1108,10 +1108,12 @@ sub buildQuery {
 
         # Regular old limits
         else {
-            $limit .= " and " if $limit || $query;
-            $limit      .= "$this_limit";
-            $limit_cgi  .= "&limit=$this_limit";
-            $limit_desc .= " $this_limit";
+            if ($this_limit){
+                $limit .= " and " if $limit || $query;
+                $limit      .= "$this_limit";
+                $limit_cgi  .= "&limit=$this_limit";
+                $limit_desc .= " $this_limit";
+            }      
         }
     }
     if ($group_OR_limits) {
-- 
1.5.4.3




More information about the Koha-patches mailing list