[Koha-patches] [PATCH] 4074 Bugfix: The 'Subject(s)' link(s) are malformed resulting in no search results

Chris Nighswonger cnighswonger at foundations.edu
Tue Feb 2 05:18:09 CET 2010


This bug was introduced by commit d51332698b2cce43542a58e53fd916df99329158
which removed the inability to do a search on anything contianing a colon (:).

This patch expands the regexp to only normalize true limit operators and leave
all other colons (:) intact.
---
 C4/Search.pm |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index 16c6a55..7e147f1 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -814,7 +814,7 @@ sub getIndexes{
                     'biblionumber',
                     'bio',
                     'biography',
-                    'callnum',          
+                    'callnum',
                     'cfn',
                     'Chronological-subdivision',
                     'cn-bib-source',
@@ -927,7 +927,7 @@ sub getIndexes{
                     'Title-uniform-seealso',
                     'totalissues',
                     'yr',
-                    
+
                     # items indexes
                     'acqsource',
                     'barcode',
@@ -964,10 +964,10 @@ sub getIndexes{
                     'stack',
                     'uri',
                     'withdrawn',
-                    
+
                     # subject related
                   );
-                  
+
     return \@indexes;
 }
 
@@ -1114,11 +1114,11 @@ sub buildQuery {
                     ) = ( 0, 0, 0, 0, 0 );
 
                 }
-                
+
                 if(not $index){
                     $index = 'kw';
                 }
-                
+
                 # Set default structure attribute (word list)
                 my $struct_attr;
                 unless ( $indexes_set || !$index || $index =~ /(st-|phr|ext|wrdl)/ ) {
@@ -1141,7 +1141,7 @@ sub buildQuery {
                 if ($auto_truncation){
 					unless ( $index =~ /(st-|phr|ext)/ ) {
 						#FIXME only valid with LTR scripts
-						$operand=join(" ",map{ 
+						$operand=join(" ",map{
 											(index($_,"*")>0?"$_":"$_*")
 											 }split (/\s+/,$operand));
 						warn $operand if $DEBUG;
@@ -1305,7 +1305,9 @@ sub buildQuery {
     # Normalize the query and limit strings
     # This is flawed , means we can't search anything with : in it
     # if user wants to do ccl or cql, start the query with that
-    $query =~ s/:/=/g;
+#    $query =~ s/:/=/g;
+    $query =~ s/(?<=(ti|au|pb|su|an|kw|mc)):/=/g;
+    $query =~ s/(?<=rtrn):/=/g;
     $limit =~ s/:/=/g;
     for ( $query, $query_desc, $limit, $limit_desc ) {
         s/  / /g;    # remove extra spaces
-- 
1.6.0.4




More information about the Koha-patches mailing list