};
subtest 'build_query tests' => sub {
- plan tests => 15;
+ plan tests => 18;
t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
my $query = $builder->build_query();
'(barcode:123456*)',
"query of specific field is truncated"
);
+
+ ( undef, $query ) = $builder->build_query_compat( undef, ['title:"donald duck"'] );
+ is(
+ $query->{query}{query_string}{query},
+ '(title:"donald duck")',
+ "query of specific field is not truncated when surrouned by quotes"
+ );
+
+ ( undef, $query ) = $builder->build_query_compat( undef, ['title:"donald duck"'], undef, undef, undef, undef, undef, { suppress => 1 } );
+ is(
+ $query->{query}{query_string}{query},
+ '(title:"donald duck") AND suppress:0',
+ "query of specific field is added AND suppress:0"
+ );
+
+ ( undef, $query ) = $builder->build_query_compat( undef, ['title:"donald duck"'], undef, undef, undef, undef, undef, { suppress => 0 } );
+ is(
+ $query->{query}{query_string}{query},
+ '(title:"donald duck")',
+ "query of specific field is not added AND suppress:0"
+ );
};