X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FTest%2FSearch%2FExplain.pm;h=7bdad0943ec9fef71be4161f4aac0f4509deee31;hp=b6655418a84ba39df775edc0825ce95b3998e368;hb=e61887a109576fa0e066547c0ce033631a290f8f;hpb=191029ee1ff351327632cb49127c7bc541b6a9b3 diff --git a/lib/ZOOM/IRSpy/Test/Search/Explain.pm b/lib/ZOOM/IRSpy/Test/Search/Explain.pm index b665541..7bdad09 100644 --- a/lib/ZOOM/IRSpy/Test/Search/Explain.pm +++ b/lib/ZOOM/IRSpy/Test/Search/Explain.pm @@ -1,4 +1,3 @@ -# $Id: Explain.pm,v 1.1 2006-10-25 12:44:55 sondberg Exp $ # See the "Main" test package for documentation @@ -22,10 +21,10 @@ sub start { Processing VariantSetInfo UnitSet); foreach my $category (@explain) { - $conn->option('databaseName', 'IR-Explain-1'); $conn->irspy_search_pqf('@attr exp-1 1=1 ' . $category, - {'category' => $category}, {}, - ZOOM::Event::RECV_SEARCH, \&found, + {'category' => $category}, + { databaseName => 'IR-Explain-1' }, + ZOOM::Event::ZEND, \&found, exception => \&error); } } @@ -34,14 +33,12 @@ sub start { sub found { my($conn, $task, $test_args, $event) = @_; my $category = $test_args->{'category'}; - my $n = $task->{rs}->size(); - my $ok = 0; - $conn->log("irspy_test", "Explain category ", $category, " gave, ", $n, + my $n = $task->{rs}->size(); + $task->{rs}->destroy(); + my $ok = ($n > 0); + $conn->log("irspy_test", "Explain category ", $category, " gave ", $n, " hit(s)."); - if ($n > 0) { - $ok = 1; - } update($conn, $category, $ok); @@ -53,9 +50,14 @@ sub error { my($conn, $task, $test_args, $exception) = @_; my $category = $test_args->{'category'}; + $task->{rs}->destroy(); $conn->log("irspy_test", "Explain category lookup failed: ", $exception); update($conn, $category, 0); + return ZOOM::IRSpy::Status::TEST_BAD + if ($exception->code() == 109 || # Database unavailable + $exception->code() == 235); # Database does not exist + return ZOOM::IRSpy::Status::TASK_DONE; }