Lines 23-29
our $child;
Link Here
|
23 |
|
23 |
|
24 |
subtest 'test_search' => sub { |
24 |
subtest 'test_search' => sub { |
25 |
|
25 |
|
26 |
plan tests => 19; |
26 |
plan tests => 20; |
27 |
|
27 |
|
28 |
t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch'); |
28 |
t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch'); |
29 |
|
29 |
|
Lines 75-81
subtest 'test_search' => sub {
Link Here
|
75 |
$search->mock('simple_search_compat', sub { |
75 |
$search->mock('simple_search_compat', sub { |
76 |
my ( $self, $query ) = @_; |
76 |
my ( $self, $query ) = @_; |
77 |
|
77 |
|
78 |
return ('unexpected query', undef, 0) unless $query eq '((author:(author)) AND ((title:(title\(s\))) OR (title:(speciäl))))'; |
78 |
return ('unexpected query', undef, 0) unless $query eq '((author:(author)) AND ((title:(title\(s\))) OR (title:(speciäl))))' || $query eq "(simple search)"; |
79 |
|
79 |
|
80 |
my @records = ($marc_record_1, $marc_record_2); |
80 |
my @records = ($marc_record_1, $marc_record_2); |
81 |
return (undef, \@records, 2); |
81 |
return (undef, \@records, 2); |
Lines 106-112
subtest 'test_search' => sub {
Link Here
|
106 |
|
106 |
|
107 |
my $rs = $Zconn->search_pqf('@and @attr 1=1 @attr 4=1 author @or @attr 1=4 title(s) @attr 1=4 speciäl'); |
107 |
my $rs = $Zconn->search_pqf('@and @attr 1=1 @attr 4=1 author @or @attr 1=4 title(s) @attr 1=4 speciäl'); |
108 |
is($Zconn->errcode(), 0, 'Search is successful: ' . $Zconn->errmsg()); |
108 |
is($Zconn->errcode(), 0, 'Search is successful: ' . $Zconn->errmsg()); |
109 |
|
109 |
|
110 |
is($rs->size(), 2, 'Two results returned'); |
110 |
is($rs->size(), 2, 'Two results returned'); |
111 |
|
111 |
|
112 |
my $returned1 = MARC::Record->new_from_xml($rs->record(0)->raw(), 'UTF-8'); |
112 |
my $returned1 = MARC::Record->new_from_xml($rs->record(0)->raw(), 'UTF-8'); |
Lines 117-122
subtest 'test_search' => sub {
Link Here
|
117 |
ok($returned2, 'Record 2 returned as MARCXML'); |
117 |
ok($returned2, 'Record 2 returned as MARCXML'); |
118 |
is($returned2->as_xml, $marc_record_2->as_xml, 'Record 2 returned properly'); |
118 |
is($returned2->as_xml, $marc_record_2->as_xml, 'Record 2 returned properly'); |
119 |
|
119 |
|
|
|
120 |
$rs = $Zconn->search_pqf('"simple search"'); |
121 |
is($Zconn->errcode(), 0, 'Search is successful: ' . $Zconn->errmsg()); |
122 |
|
120 |
# SRU protocol tests |
123 |
# SRU protocol tests |
121 |
my $base = 'http://localhost:42111'; |
124 |
my $base = 'http://localhost:42111'; |
122 |
my $ns = 'http://www.loc.gov/zing/srw/'; |
125 |
my $ns = 'http://www.loc.gov/zing/srw/'; |
123 |
- |
|
|