From d062a7adf8b80d4bc0869491113787d45b5ad0d3 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 18 Oct 2006 14:03:42 +0000 Subject: [PATCH] Attempt, once only, to re-open a closed zconn. --- web/htdocs/details/found.mc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/web/htdocs/details/found.mc b/web/htdocs/details/found.mc index 84f8514..c306375 100644 --- a/web/htdocs/details/found.mc +++ b/web/htdocs/details/found.mc @@ -1,4 +1,4 @@ -%# $Id: found.mc,v 1.13 2006-10-18 12:36:05 mike Exp $ +%# $Id: found.mc,v 1.14 2006-10-18 14:03:42 mike Exp $ <%once> use XML::LibXML; use XML::LibXML::XPathContext; @@ -55,13 +55,24 @@ if ($sort) { $query .= " 0"; } +my $tried_to_open = 0; if (!defined $conn) { + OPEN: $conn = new ZOOM::Connection("localhost:3313/IR-Explain---1"); + $conn->option(elementSetName => "zeerex"); } -$conn->option(elementSetName => "zeerex"); my $parser = new XML::LibXML(); -my $rs = $conn->search(new ZOOM::Query::CQL($query)); +my $rs; +eval { $rs = $conn->search(new ZOOM::Query::CQL($query)) }; +if ($@ && ref $@ && $@->isa('ZOOM::Exception') && + $@->code() == ZOOM::Error::CONNECTION_LOST && !$tried_to_open) { + $tried_to_open = 1; + goto OPEN; +} elsif ($@) { + die $@; +} + my $n = $rs->size(); my $skip = $params{"_skip"} || 0; -- 1.7.10.4