X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FTest%2FSearch%2FBath.pm;h=47af8943bc68d72b98bce708e17c752986114c2e;hp=ad2321a03882b699e2729db02bfe5e2a959c2535;hb=dbf1fadda290f6fa6d6e6539954667aad75639c9;hpb=3b34b5158da2cceee85f28b872365c1050e5f9aa diff --git a/lib/ZOOM/IRSpy/Test/Search/Bath.pm b/lib/ZOOM/IRSpy/Test/Search/Bath.pm index ad2321a..47af894 100644 --- a/lib/ZOOM/IRSpy/Test/Search/Bath.pm +++ b/lib/ZOOM/IRSpy/Test/Search/Bath.pm @@ -1,7 +1,29 @@ # This tests the main searches specified The Bath Profile, Release 2.0, # http://www.collectionscanada.gc.ca/bath/tp-bath2-e.htm # Specifically section 5.A.0 ("Functional Area A: Level 0 Basic -# Bibliographic Search and Retrieval") the its subsections. +# Bibliographic Search and Retrieval") and its subsections: +# http://www.collectionscanada.gc.ca/bath/tp-bath2.7-e.htm#a +# And section 5.A.1 ("Functional Area A: Level 1 Bibliographic Search +# and Retrieval") and subsections 14 (Standard Identifier Search) and +# 15 (Date of Publication Search): +# http://www.collectionscanada.gc.ca/bath/tp-bath2.10-e.htm#b +# +# The Bath Level 0 searches have different access-points, but share: +# Relation (2) 3 equal +# Position (3) 3 any position in field +# Structure (4) 2 word +# Truncation (5) 100 do not truncate +# Completeness (6) 1 incomplete subfield +# But Seb's bug report at: +# http://bugzilla.indexdata.dk/show_bug.cgi?id=3352#c0 +# wants use to use s=al t=r,l, where "s" is structure (4) and "al" is +# AND-list, which apparently sends NO structure attribute; and "t" is +# truncation (5) and "r,l" is right-and-left truncation (3). +# +# AND-listing (and selection of word or phrase-structure) is now +# invoked in the Toroid, when the list of attributes is emitted; but +# we can't test for 5=100 here, as the Bath Profile says to do, and +# then use that as justification for emitting 5=3 in the Toroid. package ZOOM::IRSpy::Test::Search::Bath; @@ -16,10 +38,11 @@ use ZOOM::IRSpy::Utils qw(isodate); my @bath_queries = ( - [ author => 1003 ], # 5.A.0.1 - [ title => 4 ], # 5.A.0.2 - [ subject => 21 ], # 5.A.0.3 - [ any => 1016 ], # 5.A.0.4 + # Name => use, rel, pos, str, tru, com + [ author => 1003, 3, 3, 2, 100, 1 ], # 5.A.0.1 + [ title => 4, 3, 3, 2, 100, 1 ], # 5.A.0.2 + [ subject => 21, 3, 3, 2, 100, 1 ], # 5.A.0.3 + [ any => 1016, 3, 3, 2, 100, 1 ], # 5.A.0.4 ); @@ -38,47 +61,37 @@ sub start_search { if $qindex >= @bath_queries; my $ref = $bath_queries[$qindex]; - my($name, $use_attr) = @$ref; + my($name, @attrs) = @$ref; - my $query = "\@attr 1=$use_attr \@attr 2=3 \@attr 3=3 \@attr 4=2 \@attr 5=100 \@attr 6=1 the"; + my $query = join(" ", map { "\@attr $_=" . $attrs[$_-1] } (1..6)) . " the"; $conn->irspy_search_pqf($query, { qindex => $qindex }, {}, - ZOOM::Event::ZEND, \&found, - "exception", \&error); + ZOOM::Event::ZEND, \&search_complete, + "exception", \&search_complete); return ZOOM::IRSpy::Status::TASK_DONE; } -sub found { +sub search_complete { my($conn, $task, $udata, $event) = @_; + my $ok = ref $event && $event->isa("ZOOM::Exception") ? 0 : 1; my $qindex = $udata->{qindex}; my $ref = $bath_queries[$qindex]; - my($name, $use_attr) = @$ref; + my($name) = @$ref; my $n = $task->{rs}->size(); - $conn->log("irspy_test", - "bath search #$qindex ('$name') found $n record", - $n==1 ? "" : "s"); + $conn->log("irspy_test", "bath search #$qindex ('$name') ", + $ok ? ("found $n record", $n==1 ? "" : "s") : + "had error: $event"); + my $rec = $conn->record(); $rec->append_entry("irspy:status", - "" . + "" . isodate(time()) . ""); return start_search($conn, $qindex+1); } -sub error { - my($conn, $task, $udata, $exception) = @_; - - $conn->log("irspy_test", "bath search had error: $exception"); - my $rec = $conn->record(); - $rec->append_entry("irspy:status", "" . - isodate(time()) . ""); - zoom_error_timeout_update($conn, $exception); - return ZOOM::IRSpy::Status::TASK_DONE; -} - - 1;