1 # This tests the main searches specified The Bath Profile, Release 2.0,
2 # http://www.collectionscanada.gc.ca/bath/tp-bath2-e.htm
3 # Specifically section 5.A.0 ("Functional Area A: Level 0 Basic
4 # Bibliographic Search and Retrieval") and its subsections:
5 # http://www.collectionscanada.gc.ca/bath/tp-bath2.7-e.htm#a
7 # The Bath Level 0 searches have different access-points, but share:
9 # Position (3) 3 any position in field
10 # Structure (4) 2 word
11 # Truncation (5) 100 do not truncate
12 # Completeness (6) 1 incomplete subfield
13 # But Seb's bug report at:
14 # http://bugzilla.indexdata.dk/show_bug.cgi?id=3352#c0
15 # wants use to use s=al t=r,l, where "s" is structure (4) and "al" is
16 # AND-list, which apparently sends NO structure attribute; and "t" is
17 # truncation (5) and "r,l" is right-and-left truncation (3).
19 # AND-listing (and selection of word or phrase-structure) is now
20 # invoked in the Toroid, when the list of attributes is emitted; but
21 # we can't test for 5=100 here, as the Bath Profile says to do, and
22 # then use that as justification for emitting 5=3 in the Toroid.
24 package ZOOM::IRSpy::Test::Search::Bath;
30 use ZOOM::IRSpy::Test;
31 our @ISA = qw(ZOOM::IRSpy::Test);
33 use ZOOM::IRSpy::Utils qw(isodate);
37 # Name => use, rel, pos, str, tru, com
38 [ author => 1003, 3, 3, 2, 100, 1 ], # 5.A.0.1
39 [ title => 4, 3, 3, 2, 100, 1 ], # 5.A.0.2
40 [ subject => 21, 3, 3, 2, 100, 1 ], # 5.A.0.3
41 [ any => 1016, 3, 3, 2, 100, 1 ], # 5.A.0.4
49 start_search($conn, 0);
54 my($conn, $qindex) = @_;
56 return ZOOM::IRSpy::Status::TEST_GOOD
57 if $qindex >= @bath_queries;
59 my $ref = $bath_queries[$qindex];
60 my($name, @attrs) = @$ref;
62 my $query = join(" ", map { "\@attr $_=" . $attrs[$_-1] } (1..6)) . " the";
63 $conn->irspy_search_pqf($query, { qindex => $qindex }, {},
64 ZOOM::Event::ZEND, \&search_complete,
65 "exception", \&search_complete);
66 return ZOOM::IRSpy::Status::TASK_DONE;
71 my($conn, $task, $udata, $event) = @_;
72 my $ok = ref $event && $event->isa("ZOOM::Exception") ? 0 : 1;
74 my $qindex = $udata->{qindex};
75 my $ref = $bath_queries[$qindex];
78 my $n = $task->{rs}->size();
80 $conn->log("irspy_test", "bath search #$qindex ('$name') ",
81 $ok ? ("found $n record", $n==1 ? "" : "s") :
84 my $rec = $conn->record();
85 $rec->append_entry("irspy:status",
86 "<irspy:search_bath name='$name' ok='$ok'>" .
87 isodate(time()) . "</irspy:search_bath>");
89 return start_search($conn, $qindex+1);