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 => 35; |
172 |
plan tests => 40; |
173 |
|
173 |
|
174 |
my $qb; |
174 |
my $qb; |
175 |
|
175 |
|
Lines 248-253
subtest 'build_query tests' => sub {
Link Here
|
248 |
is($query_cgi, 'idx=ti&q=%22donald%20duck%22&idx=au&q=walt%20disney', 'query cgi ok for multiterm query'); |
248 |
is($query_cgi, 'idx=ti&q=%22donald%20duck%22&idx=au&q=walt%20disney', 'query cgi ok for multiterm query'); |
249 |
is($query_desc, '(title:("donald duck")) (author:(walt disney))', 'query desc ok for multiterm query'); |
249 |
is($query_desc, '(title:("donald duck")) (author:(walt disney))', 'query desc ok for multiterm query'); |
250 |
|
250 |
|
|
|
251 |
( undef, $query ) = $qb->build_query_compat( undef, ['2019'], ['yr,st-year'] ); |
252 |
is( |
253 |
$query->{query}{query_string}{query}, |
254 |
'(date-of-publication:2019)', |
255 |
'Year in an st-year search is handled properly' |
256 |
); |
257 |
|
258 |
( undef, $query ) = $qb->build_query_compat( undef, ['2018-2019'], ['yr,st-year'] ); |
259 |
is( |
260 |
$query->{query}{query_string}{query}, |
261 |
'(date-of-publication:[2018 TO 2019])', |
262 |
'Year range in an st-year search is handled properly' |
263 |
); |
264 |
|
265 |
( undef, $query ) = $qb->build_query_compat( undef, ['-2019'], ['yr,st-year'] ); |
266 |
is( |
267 |
$query->{query}{query_string}{query}, |
268 |
'(date-of-publication:[* TO 2019])', |
269 |
'Open start year in year range of an st-year search is handled properly' |
270 |
); |
271 |
|
272 |
( undef, $query ) = $qb->build_query_compat( undef, ['2019-'], ['yr,st-year'] ); |
273 |
is( |
274 |
$query->{query}{query_string}{query}, |
275 |
'(date-of-publication:[2019 TO *])', |
276 |
'Open end year in year range of an st-year search is handled properly' |
277 |
); |
278 |
|
279 |
( undef, $query ) = $qb->build_query_compat( undef, ['2019-'], ['yr,st-year'], ['yr,st-numeric=-2019'] ); |
280 |
is( |
281 |
$query->{query}{query_string}{query}, |
282 |
'(date-of-publication:[2019 TO *]) AND copydate:[* TO 2019]', |
283 |
'Open end year in year range of an st-year search is handled properly' |
284 |
); |
285 |
|
286 |
# Enable auto-truncation |
251 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); |
287 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); |
252 |
|
288 |
|
253 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
289 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
254 |
- |
|
|