# HG changeset patch # User casties # Date 1371654965 -7200 # Node ID 896bea4f61a00f3771c92a66fe55af7826974fa7 # Parent a8f16569d1a6db7be3e9c71b455ade482f5f7ede try to deal with timeout on connect. diff -r a8f16569d1a6 -r 896bea4f61a0 zopeSolr.py --- a/zopeSolr.py Tue May 28 16:18:59 2013 +0200 +++ b/zopeSolr.py Wed Jun 19 17:16:05 2013 +0200 @@ -15,6 +15,7 @@ import xml.etree.ElementTree as ET import json import random +import logging #Worte die nicht in der Termliste angezeigt werden sollen #TODO: make this configurable @@ -67,7 +68,11 @@ if not getattr(self,'_v_solr_',None): - self.connect() + try: + self.connect() + except Exception, e: + logging.error("Error connecting to Solr: %s"%e) + return [] #http://localhost:8983/solr/mpiwgSources/select/?q=*:*&sort=random_12xs34%20desc&rows=1&facet=false @@ -183,9 +188,11 @@ # fls[fl]={} if not getattr(self,'_v_solr_',None): - self.connect() - - + try: + self.connect() + except Exception, e: + logging.error("Error connecting to Solr: %s"%e) + return res for x in range(begin,end,increment): query={} @@ -309,9 +316,11 @@ #teste verbindung zu solr if not getattr(self,'_v_solr_',None): - self.connect() - - + try: + self.connect() + except Exception, e: + logging.error("Error connecting to Solr: %s"%e) + return [] solrQuery = solrQuery.decode('utf-8')