else {
$string =~ s/__X__/"$commacontent"/ if $commacontent;
$string =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|&|\+|\*|\// /g;
+ #remove trailing blank at the beginning
+ $string =~ s/^ //g;
warn "leaf:$string" if $DEBUG;
# parse the string in in operator/operand/value again
$left = $1;
$operator = $2;
$right = $3;
-# warn
-# "handling unless (operator)... left:$left operator:$operator right:$right"
-# if $DEBUG;
+ warn
+"handling unless (operator)... left:$left operator:$operator right:$right"
+ if $DEBUG;
}
my $results;
# strip adv, zebra keywords, currently not handled in nozebra: wrdl, ext, phr...
- $left =~ s/[, ].*$//;
+ $left =~ s/ .*$//;
# automatic replace for short operators
$left = 'title' if $left =~ '^ti$';
$left = 'subject' if $left =~ '^su$';
$left = 'koha-Auth-Number' if $left =~ '^an$';
$left = 'keyword' if $left =~ '^kw$';
- warn "handling leaf... left:$left operator:$operator right:$right";
+ warn "handling leaf... left:$left operator:$operator right:$right" if $DEBUG;
if ( $operator && $left ne 'keyword' ) {
#do a specific search
$dbh->prepare(
"SELECT biblionumbers,value FROM nozebra WHERE server=? AND indexname=? AND value $operator ?"
);
- warn "$left / $operator / $right\n";
+ warn "$left / $operator / $right\n" if $DEBUG;
# split each word, query the DB and build the biblionumbers result
#sanitizing leftpart
my $biblionumbers;
$_ =~ s/^\s+|\s+$//;
next unless $_;
- warn "EXECUTE : $server, $left, $_";
+ warn "EXECUTE : $server, $left, $_" if $DEBUG;
$sth->execute( $server, $left, $_ )
or warn "execute failed: $!";
while ( my ( $line, $value ) = $sth->fetchrow ) {
unless ( $right =~ /^\d+$/ && $value =~ /\D/ );
warn "result : $value "
. ( $right =~ /\d/ ) . "=="
- . ( $value =~ /\D/?$line:"" ); #= $line";
+ . ( $value =~ /\D/?$line:"" ) if $DEBUG; #= $line";
}
# do a AND with existing list if there is one, otherwise, use the biblionumbers list as 1st result list
if ($results) {
- warn "NZAND";
+ warn "NZAND" if $DEBUG;
$results = NZoperatorAND($biblionumbers,$results);
}
else {