2 |
|
|
3 |
use strict; |
use strict; |
4 |
|
|
5 |
use Test::More tests => 7; |
use Test::More tests => 11; |
6 |
use Test::Exception; |
use Test::Exception; |
7 |
use Cwd qw/abs_path/; |
use Cwd qw/abs_path/; |
8 |
use File::Temp qw/tempdir/; |
use File::Temp qw/tempdir/; |
25 |
database => 'webpac2test', |
database => 'webpac2test', |
26 |
encoding => 'iso-8859-2', |
encoding => 'iso-8859-2', |
27 |
log => $log, |
log => $log, |
28 |
debug => 1, |
debug => 0, |
29 |
}; |
}; |
30 |
|
|
31 |
ok(my $est = new WebPAC::Output::Estraier( %{ $config } ), "new WebPAC::Output::Estraier"); |
ok(my $est = new WebPAC::Output::Estraier( %{ $config } ), "new WebPAC::Output::Estraier"); |
32 |
|
|
33 |
ok(my $list = $est->est_master( action => 'nodelist' ), "nodelist"); |
ok(my $list = $est->est_master( action => 'nodelist' ), "nodelist"); |
34 |
|
|
35 |
like($list , qr/$config->{database}/, "$list has $config->{database}"); |
like($list , qr/$config->{database}/, "found $config->{database}"); |
36 |
|
|
37 |
|
my $ds = { |
38 |
|
'Source' => { |
39 |
|
'name' => 'Izvor: ', |
40 |
|
'tag' => 'Source', |
41 |
|
'display' => [ 'foo' ], |
42 |
|
'search' => [ 'demo source '], |
43 |
|
}, |
44 |
|
'ID' => { |
45 |
|
'name' => 'ID', |
46 |
|
'tag' => 'IDths', |
47 |
|
'search' => [ 'bar' ], |
48 |
|
'lookup_key' => [ 'bar' ], |
49 |
|
}, |
50 |
|
'filename' => [ 'out/thes/001.html' ], |
51 |
|
'name' => 'filename', |
52 |
|
'tag' => 'filename' |
53 |
|
}; |
54 |
|
|
55 |
|
ok($est->add( id => 42, ds => $ds, type => 'search' ), "add"); |
56 |
|
|
57 |
ok($est = new WebPAC::Search::Estraier( %{ $config } ), "new WebPAC::Search::Estraier"); |
ok($est = new WebPAC::Search::Estraier( %{ $config } ), "new WebPAC::Search::Estraier"); |
58 |
|
|
59 |
my $query = 'ivan'; |
my $query = 'demo'; |
60 |
my $max = 3; |
my $max = 1; |
61 |
|
|
62 |
ok(my @res = $est->search( |
ok(my @res = $est->search( |
63 |
phrase => $query, |
phrase => $query, |
64 |
get_attr => [ qw/PersonalName TitleProper/ ], |
get_attr => [ qw/ID Source/ ], |
65 |
max => $max, |
max => $max, |
66 |
), "search $query, max: $max"); |
), "search $query, max: $max"); |
67 |
|
|