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