|
Lines 277-282
if ( $template_type eq 'advsearch' ) {
Link Here
|
| 277 |
@operands = $cgi->multi_param('q'); |
277 |
@operands = $cgi->multi_param('q'); |
| 278 |
@operators = @sanitized_operators; |
278 |
@operators = @sanitized_operators; |
| 279 |
@indexes = $cgi->multi_param('idx'); |
279 |
@indexes = $cgi->multi_param('idx'); |
|
|
280 |
$expanded = 1; # Force expanded options when editing search |
| 280 |
$template->param( |
281 |
$template->param( |
| 281 |
sort => scalar $cgi->param('sort_by'), |
282 |
sort => scalar $cgi->param('sort_by'), |
| 282 |
); |
283 |
); |
|
Lines 341-347
if ( $template_type eq 'advsearch' ) {
Link Here
|
| 341 |
{ |
342 |
{ |
| 342 |
$expanded = C4::Context->preference("expandedSearchOption") || 0 |
343 |
$expanded = C4::Context->preference("expandedSearchOption") || 0 |
| 343 |
if !defined($expanded) || $expanded !~ /^0|1$/; |
344 |
if !defined($expanded) || $expanded !~ /^0|1$/; |
| 344 |
$template->param( expanded_options => $expanded ); |
345 |
|
|
|
346 |
# Force expanded options if weight_search_submitted or whole_record are present |
| 347 |
$expanded = 1 if $cgi->param('weight_search_submitted') || $cgi->param('whole_record'); |
| 348 |
|
| 349 |
$template->param( |
| 350 |
expanded_options => $expanded, |
| 351 |
weight_search_submitted => scalar $cgi->param('weight_search_submitted'), |
| 352 |
whole_record => scalar $cgi->param('whole_record'), |
| 353 |
); |
| 345 |
} |
354 |
} |
| 346 |
|
355 |
|
| 347 |
$template->param( virtualshelves => C4::Context->preference("virtualshelves") ); |
356 |
$template->param( virtualshelves => C4::Context->preference("virtualshelves") ); |
|
Lines 436-446
for ( my $ii = 0 ; $ii < @operands ; ++$ii ) {
Link Here
|
| 436 |
|
445 |
|
| 437 |
# Params that can only have one value |
446 |
# Params that can only have one value |
| 438 |
my $scan = $params->{'scan'}; |
447 |
my $scan = $params->{'scan'}; |
| 439 |
my $count = C4::Context->preference('numSearchResults') || 20; |
448 |
my $count = C4::Context->preference('numSearchResults') || 20; |
| 440 |
my $results_per_page = $params->{'count'} || $count; |
449 |
my $results_per_page = $params->{'count'} || $count; |
| 441 |
my $offset = $params->{'offset'} || 0; |
450 |
my $offset = $params->{'offset'} || 0; |
| 442 |
my $whole_record = $params->{'whole_record'} || 0; |
451 |
my $whole_record = $params->{'whole_record'} || 0; |
| 443 |
my $weight_search = $params->{'advsearch'} ? $params->{'weight_search'} || 0 : 1; |
452 |
my $weight_search = $params->{'weight_search_submitted'} |
|
|
453 |
? ( $params->{'weight_search'} ? 1 : 0 ) # Form was submitted, use actual checkbox value |
| 454 |
: 1; # Form not submitted |
| 444 |
$offset = 0 if $offset < 0; |
455 |
$offset = 0 if $offset < 0; |
| 445 |
|
456 |
|
| 446 |
# Define some global variables |
457 |
# Define some global variables |
|
Lines 462-468
for ( my $i = 0 ; $i < @operands ; $i++ ) {
Link Here
|
| 462 |
) |
473 |
) |
| 463 |
= $builder->build_query_compat( |
474 |
= $builder->build_query_compat( |
| 464 |
\@operators, \@operands, \@indexes, \@limits, |
475 |
\@operators, \@operands, \@indexes, \@limits, |
| 465 |
\@sort_by, $scan, $lang, { weighted_fields => $weight_search, whole_record => $whole_record } |
476 |
\@sort_by, |
|
|
477 |
$scan, $lang, |
| 478 |
{ |
| 479 |
weighted_fields => $weight_search, |
| 480 |
whole_record => $whole_record, |
| 481 |
weight_search_submitted => $params->{'weight_search_submitted'} |
| 482 |
} |
| 466 |
); |
483 |
); |
| 467 |
|
484 |
|
| 468 |
$template->param( search_query => $query ) if C4::Context->preference('DumpSearchQueryTemplate'); |
485 |
$template->param( search_query => $query ) if C4::Context->preference('DumpSearchQueryTemplate'); |
|
Lines 559-565
if ( $hits == 0 && $basic_search ) {
Link Here
|
| 559 |
) |
576 |
) |
| 560 |
= $builder->build_query_compat( |
577 |
= $builder->build_query_compat( |
| 561 |
\@operators, \@operands, \@indexes, \@limits, |
578 |
\@operators, \@operands, \@indexes, \@limits, |
| 562 |
\@sort_by, $scan, $lang, { weighted_fields => $weight_search, whole_record => $whole_record } |
579 |
\@sort_by, |
|
|
580 |
$scan, $lang, |
| 581 |
{ |
| 582 |
weighted_fields => $weight_search, |
| 583 |
whole_record => $whole_record, |
| 584 |
weight_search_submitted => $params->{'weight_search_submitted'} |
| 585 |
} |
| 563 |
); |
586 |
); |
| 564 |
my $quoted_results_hashref; |
587 |
my $quoted_results_hashref; |
| 565 |
eval { |
588 |
eval { |