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 => 30; |
172 |
plan tests => 34; |
173 |
|
173 |
|
174 |
my $qb; |
174 |
my $qb; |
175 |
|
175 |
|
Lines 238-243
subtest 'build_query tests' => sub {
Link Here
|
238 |
'multiple query terms are enclosed in parenthesis while a single one is not' |
238 |
'multiple query terms are enclosed in parenthesis while a single one is not' |
239 |
); |
239 |
); |
240 |
|
240 |
|
|
|
241 |
( undef, $query ) = $qb->build_query_compat( undef, ['2019'], ['yr,st-year'] ); |
242 |
is( |
243 |
$query->{query}{query_string}{query}, |
244 |
'(date-of-publication:2019)', |
245 |
'Year in an st-year search is handled properly' |
246 |
); |
247 |
|
248 |
( undef, $query ) = $qb->build_query_compat( undef, ['2018-2019'], ['yr,st-year'] ); |
249 |
is( |
250 |
$query->{query}{query_string}{query}, |
251 |
'(date-of-publication:[2018 TO 2019])', |
252 |
'Year range in an st-year search is handled properly' |
253 |
); |
254 |
|
255 |
( undef, $query ) = $qb->build_query_compat( undef, ['-2019'], ['yr,st-year'] ); |
256 |
is( |
257 |
$query->{query}{query_string}{query}, |
258 |
'(date-of-publication:[* TO 2019])', |
259 |
'Open start year in year range of an st-year search is handled properly' |
260 |
); |
261 |
|
262 |
( undef, $query ) = $qb->build_query_compat( undef, ['2019-'], ['yr,st-year'] ); |
263 |
is( |
264 |
$query->{query}{query_string}{query}, |
265 |
'(date-of-publication:[2019 TO *])', |
266 |
'Open end year in year range of an st-year search is handled properly' |
267 |
); |
268 |
|
269 |
# Enable auto-truncation |
241 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); |
270 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '1' ); |
242 |
|
271 |
|
243 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
272 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
244 |
- |
|
|