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
'Koha-Auth-Number',
'l-format',
'language',
+ 'language-original',
'lc-card',
'LC-card-number',
'lcn',
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 {
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;
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
# loop through all of the records we've retrieved
for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) {
- my $marcrecord = eval { MARC::File::USMARC::decode( $marcresults->[$i] ) };
- warn "ERROR DECODING RECORD - $@: " . $marcresults->[$i] if $@;
- next if $@;
+ my $marcrecord = eval { MARC::File::USMARC::decode( $marcresults->[$i] ); };
+ if ( $@ ) {
+ warn "ERROR DECODING RECORD - $@: " . $marcresults->[$i];
+ next;
+ }
my $fw = $scan
? undef
sub z3950_search_args {
my $bibrec = shift;
- my $isbn = Business::ISBN->new($bibrec);
+
+ my $isbn_string = ref( $bibrec ) ? $bibrec->{title} : $bibrec;
+ my $isbn = Business::ISBN->new( $isbn_string );
if (defined $isbn && $isbn->is_valid)
{
- $bibrec = { isbn => $bibrec } if !ref $bibrec;
+ if ( ref($bibrec) ) {
+ $bibrec->{isbn} = $isbn_string;
+ $bibrec->{title} = undef;
+ } else {
+ $bibrec = { isbn => $isbn_string };
+ }
}
else {
$bibrec = { title => $bibrec } if !ref $bibrec;