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
6 # And section 5.A.1 ("Functional Area A: Level 1 Bibliographic Search
7 # and Retrieval") and subsections 14 (Standard Identifier Search) and
8 # 15 (Date of Publication Search):
9 # http://www.collectionscanada.gc.ca/bath/tp-bath2.10-e.htm#b
11 # The Bath Level 0 searches have different access-points, but share:
12 # Relation (2) 3 equal
13 # Position (3) 3 any position in field
14 # Structure (4) 2 word
15 # Truncation (5) 100 do not truncate
16 # Completeness (6) 1 incomplete subfield
17 # But Seb's bug report at:
18 # http://bugzilla.indexdata.dk/show_bug.cgi?id=3352#c0
19 # wants use to use s=al t=r,l, where "s" is structure (4) and "al" is
20 # AND-list, which apparently sends NO structure attribute; and "t" is
21 # truncation (5) and "r,l" is right-and-left truncation (3).
23 # AND-listing (and selection of word or phrase-structure) is now
24 # invoked in the Toroid, when the list of attributes is emitted; but
25 # we can't test for 5=100 here, as the Bath Profile says to do, and
26 # then use that as justification for emitting 5=3 in the Toroid.
28 package ZOOM::IRSpy::Test::Search::Bath;
34 use ZOOM::IRSpy::Test;
35 our @ISA = qw(ZOOM::IRSpy::Test);
37 use ZOOM::IRSpy::Utils qw(isodate);
41 # Name => use, rel, pos, str, tru, com
42 [ author => 1003, 3, 3, 2, 100, 1 ], # 5.A.0.1
43 [ title => 4, 3, 3, 2, 100, 1 ], # 5.A.0.2
44 [ subject => 21, 3, 3, 2, 100, 1 ], # 5.A.0.3
45 [ any => 1016, 3, 3, 2, 100, 1 ], # 5.A.0.4
46 [ ident => 1007, 3, 1, 1, 100, 1 ], # 5.A.1.14
47 [ date => 31, 3, 1, 4, 100, 1 ], # 5.A.1.15
55 start_search($conn, 0);
60 my($conn, $qindex) = @_;
62 return ZOOM::IRSpy::Status::TEST_GOOD
63 if $qindex >= @bath_queries;
65 my $ref = $bath_queries[$qindex];
66 my($name, @attrs) = @$ref;
68 my $query = join(" ", map { "\@attr $_=" . $attrs[$_-1] } (1..6)) . " the";
69 $conn->irspy_search_pqf($query, { qindex => $qindex }, {},
70 ZOOM::Event::ZEND, \&search_complete,
71 "exception", \&search_complete);
72 return ZOOM::IRSpy::Status::TASK_DONE;
77 my($conn, $task, $udata, $event) = @_;
78 my $ok = ref $event && $event->isa("ZOOM::Exception") ? 0 : 1;
80 my $qindex = $udata->{qindex};
81 my $ref = $bath_queries[$qindex];
84 my $n = $task->{rs}->size();
86 $conn->log("irspy_test", "bath search #$qindex ('$name') ",
87 $ok ? ("found $n record", $n==1 ? "" : "s") :
90 my $rec = $conn->record();
91 $rec->append_entry("irspy:status",
92 "<irspy:search_bath name='$name' ok='$ok'>" .
93 isodate(time()) . "</irspy:search_bath>");
95 return start_search($conn, $qindex+1);