|
Lines 252-258
subtest 'build_authorities_query_compat() tests' => sub {
Link Here
|
| 252 |
}; |
252 |
}; |
| 253 |
|
253 |
|
| 254 |
subtest 'build_query tests' => sub { |
254 |
subtest 'build_query tests' => sub { |
| 255 |
plan tests => 69; |
255 |
plan tests => 72; |
| 256 |
|
256 |
|
| 257 |
my $qb; |
257 |
my $qb; |
| 258 |
|
258 |
|
|
Lines 342-347
subtest 'build_query tests' => sub {
Link Here
|
| 342 |
is( $query_cgi, 'idx=ti&q=%22donald%20duck%22&idx=au&q=walt%20disney', 'query cgi ok for multiterm query' ); |
342 |
is( $query_cgi, 'idx=ti&q=%22donald%20duck%22&idx=au&q=walt%20disney', 'query cgi ok for multiterm query' ); |
| 343 |
is( $query_desc, '(title:("donald duck")) (author:(walt disney))', 'query desc ok for multiterm query' ); |
343 |
is( $query_desc, '(title:("donald duck")) (author:(walt disney))', 'query desc ok for multiterm query' ); |
| 344 |
|
344 |
|
|
|
345 |
# Test whole_record and weighted_fields parameters in query_cgi |
| 346 |
( undef, $query, $simple_query, $query_cgi, $query_desc ) = $qb->build_query_compat( |
| 347 |
undef, ['test'], ['kw'], undef, undef, undef, undef, |
| 348 |
{ whole_record => 1, weighted_fields => 1, weight_search_submitted => 1 } |
| 349 |
); |
| 350 |
is( |
| 351 |
$query_cgi, 'idx=kw&q=test&weight_search=1&weight_search_submitted=1&whole_record=1', |
| 352 |
'query_cgi includes whole_record, weight_search and weight_search_submitted parameters' |
| 353 |
); |
| 354 |
|
| 355 |
( undef, $query, $simple_query, $query_cgi, $query_desc ) = $qb->build_query_compat( |
| 356 |
undef, ['test'], ['kw'], undef, undef, undef, undef, |
| 357 |
{ whole_record => 1 } |
| 358 |
); |
| 359 |
is( $query_cgi, 'idx=kw&q=test&whole_record=1', 'query_cgi includes whole_record parameter only' ); |
| 360 |
|
| 361 |
( undef, $query, $simple_query, $query_cgi, $query_desc ) = $qb->build_query_compat( |
| 362 |
undef, ['test'], ['kw'], undef, undef, undef, undef, |
| 363 |
{ weighted_fields => 1, weight_search_submitted => 1 } |
| 364 |
); |
| 365 |
is( |
| 366 |
$query_cgi, 'idx=kw&q=test&weight_search=1&weight_search_submitted=1', |
| 367 |
'query_cgi includes weight_search and weight_search_submitted parameters only' |
| 368 |
); |
| 369 |
|
| 345 |
( undef, $query ) = $qb->build_query_compat( undef, ['2019'], ['yr,st-year'] ); |
370 |
( undef, $query ) = $qb->build_query_compat( undef, ['2019'], ['yr,st-year'] ); |
| 346 |
is( |
371 |
is( |
| 347 |
$query->{query}{bool}{must}[0]{query_string}{query}, |
372 |
$query->{query}{bool}{must}[0]{query_string}{query}, |
| 348 |
- |
|
|