Lines 169-175
subtest 'build_authorities_query_compat() tests' => sub {
Link Here
|
169 |
}; |
169 |
}; |
170 |
|
170 |
|
171 |
subtest 'build_query tests' => sub { |
171 |
subtest 'build_query tests' => sub { |
172 |
plan tests => 26; |
172 |
plan tests => 29; |
173 |
|
173 |
|
174 |
my $qb; |
174 |
my $qb; |
175 |
|
175 |
|
Lines 224-229
subtest 'build_query tests' => sub {
Link Here
|
224 |
"query not altered if QueryAutoTruncate disabled" |
224 |
"query not altered if QueryAutoTruncate disabled" |
225 |
); |
225 |
); |
226 |
|
226 |
|
|
|
227 |
my ($simple_query, $query_cgi, $query_desc); |
228 |
( undef, $query, $simple_query, $query_cgi, $query_desc ) = $qb->build_query_compat( undef, ['"donald duck"', 'walt disney'], ['ti', 'au'] ); |
229 |
is($query_cgi, 'idx=ti&q=%22donald%20duck%22&idx=au&q=walt%20disney', 'query cgi ok for multiterm query'); |
230 |
is($query_desc, '(title:"donald duck") (author:walt disney)', 'query desc ok for multiterm query'); |
231 |
|
227 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); |
232 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); |
228 |
|
233 |
|
229 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
234 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
Lines 334-347
subtest 'build_query tests' => sub {
Link Here
|
334 |
"query of specific field is added AND suppress:0" |
339 |
"query of specific field is added AND suppress:0" |
335 |
); |
340 |
); |
336 |
|
341 |
|
337 |
my ($simple_query, $query_cgi); |
342 |
( undef, $query, $simple_query, $query_cgi, $query_desc ) = $qb->build_query_compat( undef, ['title:"donald duck"'], undef, undef, undef, undef, undef, { suppress => 0 } ); |
338 |
( undef, $query, $simple_query, $query_cgi ) = $qb->build_query_compat( undef, ['title:"donald duck"'], undef, undef, undef, undef, undef, { suppress => 0 } ); |
|
|
339 |
is( |
343 |
is( |
340 |
$query->{query}{query_string}{query}, |
344 |
$query->{query}{query_string}{query}, |
341 |
'(title:"donald duck")', |
345 |
'(title:"donald duck")', |
342 |
"query of specific field is not added AND suppress:0" |
346 |
"query of specific field is not added AND suppress:0" |
343 |
); |
347 |
); |
344 |
is($query_cgi, 'q=title%3A%22donald%20duck%22', 'query cgi'); |
348 |
is($query_cgi, 'idx=&q=title%3A%22donald%20duck%22', 'query cgi'); |
|
|
349 |
is($query_desc, 'title:"donald duck"', 'query desc ok'); |
345 |
}; |
350 |
}; |
346 |
|
351 |
|
347 |
|
352 |
|
348 |
- |
|
|