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 [ author => 1003 ], # 5.A.0.1
38 [ title => 4 ], # 5.A.0.2
39 [ subject => 21 ], # 5.A.0.3
40 [ any => 1016 ], # 5.A.0.4
48 start_search($conn, 0);
53 my($conn, $qindex) = @_;
55 return ZOOM::IRSpy::Status::TEST_GOOD
56 if $qindex >= @bath_queries;
58 my $ref = $bath_queries[$qindex];
59 my($name, $use_attr) = @$ref;
61 my $query = "\@attr 1=$use_attr \@attr 2=3 \@attr 3=3 \@attr 4=2 \@attr 5=100 \@attr 6=1 the";
62 $conn->irspy_search_pqf($query, { qindex => $qindex }, {},
63 ZOOM::Event::ZEND, \&search_complete,
64 "exception", \&search_complete);
65 return ZOOM::IRSpy::Status::TASK_DONE;
70 my($conn, $task, $udata, $event) = @_;
71 my $ok = ref $event && $event->isa("ZOOM::Exception") ? 0 : 1;
73 my $qindex = $udata->{qindex};
74 my $ref = $bath_queries[$qindex];
77 my $n = $task->{rs}->size();
79 $conn->log("irspy_test", "bath search #$qindex ('$name') ",
80 $ok ? ("found $n record", $n==1 ? "" : "s") :
83 my $rec = $conn->record();
84 $rec->append_entry("irspy:status",
85 "<irspy:search_bath name='$name' ok='$ok'>" .
86 isodate(time()) . "</irspy:search_bath>");
88 return start_search($conn, $qindex+1);