X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FSearch.pm;h=18a0f5f23288b30fbcc5569cbbbf26507951bd7f;hb=4e4a33ef5deecc32711092d78d87f2eefe3fbcf5;hp=c9f256032403479d3dca70f2df4fe54af68d9945;hpb=1c0a2f6b408e0c099bb55a270eb911a63f3521d9;p=koha.git diff --git a/C4/Search.pm b/C4/Search.pm index c9f2560324..18a0f5f232 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -847,6 +847,7 @@ sub _build_weighted_query { my $stemming = C4::Context->preference("QueryStemming") || 0; my $weight_fields = C4::Context->preference("QueryWeightFields") || 0; my $fuzzy_enabled = C4::Context->preference("QueryFuzzy") || 0; + $operand =~ s/"/ /g; # Bug 7518: searches with quotation marks don't work my $weighted_query .= "(rk=("; # Specifies that we're applying rank @@ -986,6 +987,7 @@ sub getIndexes{ 'Koha-Auth-Number', 'l-format', 'language', + 'language-original', 'lc-card', 'LC-card-number', 'lcn', @@ -1188,7 +1190,10 @@ sub parseQuery { next unless $operands[$ii]; $query .= $operators[ $ii - 1 ] eq 'or' ? ' || ' : ' && ' if ($query); - if ( $indexes[$ii] =~ m/su-/ ) { + if ( $operands[$ii] =~ /^[^"]\W*[-|_\w]*:\w.*[^"]$/ ) { + $query .= $operands[$ii]; + } + elsif ( $indexes[$ii] =~ m/su-/ ) { $query .= $indexes[$ii] . '(' . $operands[$ii] . ')'; } else { @@ -1281,7 +1286,7 @@ sub buildQuery { my $cclq = 0; my $cclindexes = getIndexes(); - if ( $query !~ /\s*ccl=/ ) { + if ( $query !~ /\s*(ccl=|pqf=|cql=)/ ) { while ( !$cclq && $query =~ /(?:^|\W)([\w-]+)(,[\w-]+)*[:=]/g ) { my $dx = lc($1); $cclq = grep { lc($_) eq $dx } @$cclindexes; @@ -1681,7 +1686,9 @@ sub searchResults { while ( ( my $column ) = $sth2->fetchrow ) { my ( $tagfield, $tagsubfield ) = &GetMarcFromKohaField( "items." . $column, "" ); - $subfieldstosearch{$column} = $tagsubfield; + if ( defined $tagsubfield ) { + $subfieldstosearch{$column} = $tagsubfield; + } } # handle which records to actually retrieve