|
Lines 449-461
subtest 'build_query tests' => sub {
Link Here
|
| 449 |
"query of boolean type field is not truncated even if QueryAutoTruncate is set" |
449 |
"query of boolean type field is not truncated even if QueryAutoTruncate is set" |
| 450 |
); |
450 |
); |
| 451 |
|
451 |
|
| 452 |
( undef, $query ) = |
452 |
subtest 'removal of punctuation surrounded by spaces when autotruncate enabled' => sub { |
| 453 |
$qb->build_query_compat( undef, ['First title ; Second title : some & subtitle / Authors Name'] ); |
453 |
plan tests => 4; |
| 454 |
is( |
454 |
( undef, $query ) = |
| 455 |
$query->{query}{query_string}{query}, |
455 |
$qb->build_query_compat( undef, ['First title ; Second title : some & subtitle / Authors Name'] ); |
| 456 |
'(First* title* Second* title* some* subtitle* Authors* Name*)', |
456 |
is( |
| 457 |
"ISBD punctualtion and problematic characters properly removed" |
457 |
$query->{query}{query_string}{query}, |
| 458 |
); |
458 |
'(First* title* Second* title* some* subtitle* Authors* Name*)', |
|
|
459 |
"ISBD punctuation and problematic characters surrounded by spaces properly removed" |
| 460 |
); |
| 461 |
|
| 462 |
( undef, $query ) = |
| 463 |
$qb->build_query_compat( undef, ['comma , period . equal = hyphen - slash / escaped_slash \/'] ); |
| 464 |
is( |
| 465 |
$query->{query}{query_string}{query}, |
| 466 |
'(comma* period* equal* hyphen* slash* escaped_slash*)', |
| 467 |
"Other problematic characters surrounded by spaces properly removed" |
| 468 |
); |
| 469 |
|
| 470 |
( undef, $query ) = |
| 471 |
$qb->build_query_compat( undef, [' &;,:=-/ &&&==&& ::-:: '] ); |
| 472 |
is( |
| 473 |
$query->{query}{query_string}{query}, |
| 474 |
'()', |
| 475 |
"Repeated problematic characters surrounded by spaces removed" |
| 476 |
); |
| 477 |
|
| 478 |
( undef, $query ) = $qb->build_query_compat( |
| 479 |
undef, |
| 480 |
[ |
| 481 |
'& amp& semicolon; ;colonsemi full: :full comma, ,comma dot. .dot =equal equal= hyphen- -hypen slash\\/ \\/slash' |
| 482 |
] |
| 483 |
); |
| 484 |
is( |
| 485 |
$query->{query}{query_string}{query}, |
| 486 |
'(&* amp& semicolon; ;colonsemi* full* full* comma, ,comma* dot. .dot* equal* equal* hyphen- -hypen* slash\/ \/slash*)', |
| 487 |
"ISBD punctuation and problematic characters not removed when not surrounded by spaces." |
| 488 |
); |
| 489 |
|
| 490 |
# Note above: semicolons and equals removed asthose are search field indicators - terms ending in punctuation |
| 491 |
# are not truncated |
| 492 |
}; |
| 459 |
|
493 |
|
| 460 |
( undef, $query ) = $qb->build_query_compat( undef, ['J.R.R'] ); |
494 |
( undef, $query ) = $qb->build_query_compat( undef, ['J.R.R'] ); |
| 461 |
is( |
495 |
is( |
| 462 |
- |
|
|