more informative erro message [error connecting to Solr]
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Fri, 14 Sep 2012 12:08:22 +0000 (14:08 +0200)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Fri, 14 Sep 2012 12:08:22 +0000 (14:08 +0200)
apps/search/custom.py

index 788b6c4..86d387e 100644 (file)
@@ -5,7 +5,7 @@ import urllib
 import warnings
 from sunburnt import search
 import copy
-
+from httplib2 import socket
 
 class TermVectorOptions(search.Options):
     def __init__(self, schema, original=None):
@@ -89,7 +89,11 @@ class CustomSolrInterface(sunburnt.SolrInterface):
             self.writeable = False
         elif 'r' not in mode:
             self.readable = False
-        self.init_schema()
+        try:
+            self.init_schema()
+        except socket.error, e:
+            raise socket.error, "Cannot connect to Solr server, and search indexing is enabled (%s)" % str(e)
+            
 
     def _analyze(self, **kwargs):
         if not self.readable: