|
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 => 30; |
| 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 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'], ['title'] ); |
| 228 |
is( |
| 229 |
$query->{query}{query_string}{query}, |
| 230 |
'(title:(donald duck))', |
| 231 |
'multiple words in a query term are enclosed in parenthesis' |
| 232 |
); |
| 233 |
|
| 234 |
( undef, $query ) = $qb->build_query_compat( ['AND'], ['donald duck', 'disney'], ['title', 'author'] ); |
| 235 |
is( |
| 236 |
$query->{query}{query_string}{query}, |
| 237 |
'(title:(donald duck)) AND (author:disney)', |
| 238 |
'multiple query terms are enclosed in parenthesis while a single one is not' |
| 239 |
); |
| 240 |
|
| 227 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); |
241 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); |
| 228 |
|
242 |
|
| 229 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
243 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
|
Lines 324-330
subtest 'build_query tests' => sub {
Link Here
|
| 324 |
is( |
338 |
is( |
| 325 |
$query->{query}{query_string}{query}, |
339 |
$query->{query}{query_string}{query}, |
| 326 |
'(title:"donald duck")', |
340 |
'(title:"donald duck")', |
| 327 |
"query of specific field is not truncated when surrouned by quotes" |
341 |
"query of specific field is not truncated when surrounded by quotes" |
|
|
342 |
); |
| 343 |
|
| 344 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'], ['title'] ); |
| 345 |
is( |
| 346 |
$query->{query}{query_string}{query}, |
| 347 |
'(title:(donald* duck*))', |
| 348 |
'words of a multi-word term are properly truncated' |
| 349 |
); |
| 350 |
|
| 351 |
( undef, $query ) = $qb->build_query_compat( ['AND'], ['donald duck', 'disney'], ['title', 'author'] ); |
| 352 |
is( |
| 353 |
$query->{query}{query_string}{query}, |
| 354 |
'(title:(donald* duck*)) AND (author:disney*)', |
| 355 |
'words of a multi-word term and single-word term are properly truncated' |
| 328 |
); |
356 |
); |
| 329 |
|
357 |
|
| 330 |
( undef, $query ) = $qb->build_query_compat( undef, ['title:"donald duck"'], undef, undef, undef, undef, undef, { suppress => 1 } ); |
358 |
( undef, $query ) = $qb->build_query_compat( undef, ['title:"donald duck"'], undef, undef, undef, undef, undef, { suppress => 1 } ); |
| 331 |
- |
|
|