Lines 1193-1203
sub parseQuery {
Link Here
|
1193 |
} |
1193 |
} |
1194 |
foreach my $limit (@limits) { |
1194 |
foreach my $limit (@limits) { |
1195 |
} |
1195 |
} |
1196 |
foreach my $modifier (@sort_by) { |
1196 |
if (scalar (@sort_by) > 0) { |
1197 |
$query .= " #$modifier"; |
1197 |
my $modifier_re = '#(' . join( '|', @{$QParser->modifiers}) . ')'; |
|
|
1198 |
$query =~ s/$modifier_re//g; |
1199 |
foreach my $modifier (@sort_by) { |
1200 |
$query .= " #$modifier"; |
1201 |
} |
1198 |
} |
1202 |
} |
1199 |
|
1203 |
|
1200 |
$query_desc = $query; |
1204 |
$query_desc = $query; |
|
|
1205 |
$query_desc =~ s/\s+/ /g; |
1201 |
if ( C4::Context->preference("QueryWeightFields") ) { |
1206 |
if ( C4::Context->preference("QueryWeightFields") ) { |
1202 |
} |
1207 |
} |
1203 |
$QParser->add_bib1_filter_map( 'biblioserver', 'su-br', { 'callback' => \&_handle_exploding_index }); |
1208 |
$QParser->add_bib1_filter_map( 'biblioserver', 'su-br', { 'callback' => \&_handle_exploding_index }); |
Lines 1205-1213
sub parseQuery {
Link Here
|
1205 |
$QParser->add_bib1_filter_map( 'biblioserver', 'su-rl', { 'callback' => \&_handle_exploding_index }); |
1210 |
$QParser->add_bib1_filter_map( 'biblioserver', 'su-rl', { 'callback' => \&_handle_exploding_index }); |
1206 |
$QParser->parse( $query ); |
1211 |
$QParser->parse( $query ); |
1207 |
$operands[0] = "pqf=" . $QParser->target_syntax('biblioserver'); |
1212 |
$operands[0] = "pqf=" . $QParser->target_syntax('biblioserver'); |
1208 |
# TODO: once we are using QueryParser, all this special case code for |
1213 |
} else { |
1209 |
# exploded search indexes will be replaced by a callback to |
1214 |
my $modifier_re = '#(' . join( '|', @{Koha::QueryParser::Driver::PQF->modifiers}) . ')'; |
1210 |
# _handle_exploding_index |
1215 |
s/$modifier_re//g for @operands; |
1211 |
} |
1216 |
} |
1212 |
|
1217 |
|
1213 |
return ( $operators, \@operands, $indexes, $limits, $sort_by, $scan, $lang, $query_desc); |
1218 |
return ( $operators, \@operands, $indexes, $limits, $sort_by, $scan, $lang, $query_desc); |
Lines 1291-1307
sub buildQuery {
Link Here
|
1291 |
if ( @limits ) { |
1296 |
if ( @limits ) { |
1292 |
$q .= ' and '.join(' and ', @limits); |
1297 |
$q .= ' and '.join(' and ', @limits); |
1293 |
} |
1298 |
} |
1294 |
return ( undef, $q, $q, "q=ccl=$q", $q, '', '', '', '', 'ccl' ); |
1299 |
return ( undef, $q, $q, "q=ccl=".uri_escape($q), $q, '', '', '', '', 'ccl' ); |
1295 |
} |
1300 |
} |
1296 |
if ( $query =~ /^cql=/ ) { |
1301 |
if ( $query =~ /^cql=/ ) { |
1297 |
return ( undef, $', $', "q=cql=$'", $', '', '', '', '', 'cql' ); |
1302 |
return ( undef, $', $', "q=cql=".uri_escape($'), $', '', '', '', '', 'cql' ); |
1298 |
} |
1303 |
} |
1299 |
if ( $query =~ /^pqf=/ ) { |
1304 |
if ( $query =~ /^pqf=/ ) { |
1300 |
if ($query_desc) { |
1305 |
if ($query_desc) { |
1301 |
$query_cgi = "q=$query_desc"; |
1306 |
$query_cgi = "q=".uri_escape($query_desc); |
1302 |
} else { |
1307 |
} else { |
1303 |
$query_desc = $'; |
1308 |
$query_desc = $'; |
1304 |
$query_cgi = "q=pqf=$'"; |
1309 |
$query_cgi = "q=pqf=".uri_escape($'); |
1305 |
} |
1310 |
} |
1306 |
return ( undef, $', $', $query_cgi, $query_desc, '', '', '', '', 'pqf' ); |
1311 |
return ( undef, $', $', $query_cgi, $query_desc, '', '', '', '', 'pqf' ); |
1307 |
} |
1312 |
} |
Lines 1473-1481
sub buildQuery {
Link Here
|
1473 |
$query .= " $operators[$i-1] "; |
1478 |
$query .= " $operators[$i-1] "; |
1474 |
$query .= " $index_plus " unless $indexes_set; |
1479 |
$query .= " $index_plus " unless $indexes_set; |
1475 |
$query .= " $operand"; |
1480 |
$query .= " $operand"; |
1476 |
$query_cgi .= "&op=$operators[$i-1]"; |
1481 |
$query_cgi .= "&op=".uri_escape($operators[$i-1]); |
1477 |
$query_cgi .= "&idx=$index" if $index; |
1482 |
$query_cgi .= "&idx=".uri_escape($index) if $index; |
1478 |
$query_cgi .= "&q=$operands[$i]" if $operands[$i]; |
1483 |
$query_cgi .= "&q=".uri_escape($operands[$i]) if $operands[$i]; |
1479 |
$query_desc .= |
1484 |
$query_desc .= |
1480 |
" $operators[$i-1] $index_plus $operands[$i]"; |
1485 |
" $operators[$i-1] $index_plus $operands[$i]"; |
1481 |
} |
1486 |
} |
Lines 1485-1492
sub buildQuery {
Link Here
|
1485 |
$query .= " and "; |
1490 |
$query .= " and "; |
1486 |
$query .= "$index_plus " unless $indexes_set; |
1491 |
$query .= "$index_plus " unless $indexes_set; |
1487 |
$query .= "$operand"; |
1492 |
$query .= "$operand"; |
1488 |
$query_cgi .= "&op=and&idx=$index" if $index; |
1493 |
$query_cgi .= "&op=and&idx=".uri_escape($index) if $index; |
1489 |
$query_cgi .= "&q=$operands[$i]" if $operands[$i]; |
1494 |
$query_cgi .= "&q=".uri_escape($operands[$i]) if $operands[$i]; |
1490 |
$query_desc .= " and $index_plus $operands[$i]"; |
1495 |
$query_desc .= " and $index_plus $operands[$i]"; |
1491 |
} |
1496 |
} |
1492 |
} |
1497 |
} |
Lines 1498-1505
sub buildQuery {
Link Here
|
1498 |
$query .= " $index_plus " unless $indexes_set; |
1503 |
$query .= " $index_plus " unless $indexes_set; |
1499 |
$query .= $operand; |
1504 |
$query .= $operand; |
1500 |
$query_desc .= " $index_plus $operands[$i]"; |
1505 |
$query_desc .= " $index_plus $operands[$i]"; |
1501 |
$query_cgi .= "&idx=$index" if $index; |
1506 |
$query_cgi .= "&idx=".uri_escape($index) if $index; |
1502 |
$query_cgi .= "&q=$operands[$i]" if $operands[$i]; |
1507 |
$query_cgi .= "&q=".uri_escape($operands[$i]) if $operands[$i]; |
1503 |
$previous_operand = 1; |
1508 |
$previous_operand = 1; |
1504 |
} |
1509 |
} |
1505 |
} #/if $operands |
1510 |
} #/if $operands |