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
53 start_search($conn, 0);
58 my($conn, $qindex) = @_;
60 return ZOOM::IRSpy::Status::TEST_GOOD
61 if $qindex >= @bath_queries;
63 my $ref = $bath_queries[$qindex];
64 my($name, @attrs) = @$ref;
66 my $query = join(" ", map { "\@attr $_=" . $attrs[$_-1] } (1..6)) . " the";
67 $conn->irspy_search_pqf($query, { qindex => $qindex }, {},
68 ZOOM::Event::ZEND, \&search_complete,
69 "exception", \&search_complete);
70 return ZOOM::IRSpy::Status::TASK_DONE;
75 my($conn, $task, $udata, $event) = @_;
76 my $ok = ref $event && $event->isa("ZOOM::Exception") ? 0 : 1;
78 my $qindex = $udata->{qindex};
79 my $ref = $bath_queries[$qindex];
82 my $n = $task->{rs}->size();
84 $conn->log("irspy_test", "bath search #$qindex ('$name') ",
85 $ok ? ("found $n record", $n==1 ? "" : "s") :
88 my $rec = $conn->record();
89 $rec->append_entry("irspy:status",
90 "<irspy:search_bath name='$name' ok='$ok'>" .
91 isodate(time()) . "</irspy:search_bath>");
93 return start_search($conn, $qindex+1);