[ckan-changes] commit/ckan: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Tue Sep 27 16:17:03 UTC 2011


2 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/c4ffb04ee7cb/
changeset:   c4ffb04ee7cb
user:        dread
date:        2011-09-27 11:24:38
summary:     [doc][xs]: Tidy doc formatting for solr setup.
affected #:  1 file (-1 bytes)

--- a/doc/install-from-source.rst	Tue Sep 27 16:25:07 2011 +0100
+++ b/doc/install-from-source.rst	Tue Sep 27 10:24:38 2011 +0100
@@ -251,9 +251,9 @@
        JETTY_PORT=8983       # (line 18)
 
    Then create a symlink from the schema.xml file in your ckan config
-   directory to the solr config directory. 
+   directory to the Solr config directory:
 
-.. note:: The first reference to schema.xml will probably need to be to be correct for your system.NB it must be an absolute path):
+     Note: The path ``~/pyenv/src/ckan/ckan/config/schema.xml`` will probably need to be to be adjusted for your system. Also ensure it is an absolute path.
 
    ::
     
@@ -266,13 +266,13 @@
        ckan.site_id=my_ckan_instance
        solr_url=http://127.0.0.1:8983/solr
 
-   You should now be able to start solr:
+   You should now be able to start Solr:
 
    ::
 
        sudo service jetty start
 
-   Now you should check SOLR is running ok by browsing: http://localhost:8983/solr/
+   Now you should check Solr is running ok by browsing: http://localhost:8983/solr/
 
    For more information on Solr setup and configuration, see the CKAN wiki:
    http://wiki.ckan.net/Solr_Search


http://bitbucket.org/okfn/ckan/changeset/73b707460f04/
changeset:   73b707460f04
user:        dread
date:        2011-09-27 18:11:42
summary:     [tests][s]: #1275 Make the tests use the default solr_url, same as ckan does.
affected #:  4 files (-1 bytes)

--- a/ckan/lib/search/__init__.py	Tue Sep 27 10:24:38 2011 +0100
+++ b/ckan/lib/search/__init__.py	Tue Sep 27 17:11:42 2011 +0100
@@ -5,7 +5,7 @@
 from ckan.model import DomainObjectOperation
 from ckan.plugins import SingletonPlugin, implements, IDomainObjectModification
 from ckan.lib.dictization.model_dictize import package_to_api1
-from common import SearchIndexError, SearchError, make_connection, is_available
+from common import SearchIndexError, SearchError, make_connection, is_available, DEFAULT_SOLR_URL
 from index import PackageSearchIndex, NoopSearchIndex
 from query import TagSearchQuery, ResourceSearchQuery, PackageSearchQuery, QueryOptions
 


--- a/ckan/lib/search/common.py	Tue Sep 27 10:24:38 2011 +0100
+++ b/ckan/lib/search/common.py	Tue Sep 27 17:11:42 2011 +0100
@@ -5,7 +5,9 @@
 class SearchIndexError(Exception): pass
 class SearchError(Exception): pass
 
-solr_url = config.get('solr_url', 'http://127.0.0.1:8983/solr')
+DEFAULT_SOLR_URL = 'http://127.0.0.1:8983/solr'
+
+solr_url = config.get('solr_url', DEFAULT_SOLR_URL)
 solr_user = config.get('solr_user')
 solr_password = config.get('solr_password')
 


--- a/ckan/tests/lib/test_solr_search_index.py	Tue Sep 27 10:24:38 2011 +0100
+++ b/ckan/tests/lib/test_solr_search_index.py	Tue Sep 27 17:11:42 2011 +0100
@@ -1,3 +1,4 @@
+import socket
 import solr
 from pylons import config
 from ckan import model
@@ -13,11 +14,17 @@
             from nose import SkipTest
             raise SkipTest("Search not supported")
 
-        assert config.get('solr_url')
-        # solr.SolrConnection.query will throw an exception if it can't connect
-        conn = solr.SolrConnection(config.get('solr_url'))
-        q = conn.query("*:*", rows=1)
-        conn.close()
+        conn = search.make_connection()
+        try:
+            # solr.SolrConnection.query will throw a socket.error if it
+            # can't connect to the SOLR instance
+            q = conn.query("*:*", rows=1)
+            conn.close()
+        except socket.error, e:
+            if not config.get('solr_url'):
+                raise AssertionError("Config option 'solr_url' needs to be defined in this CKAN's development.ini. Default of %s didn't work: %s" % (search.DEFAULT_SOLR_URL, e))
+            else:
+                raise AssertionError('SOLR connection problem. Connection defined in development.ini as: solr_url=%s Error: %s' % (config['solr_url'], e))
 
 
 class TestSolrSearchIndex(TestController):
@@ -29,8 +36,8 @@
     def setup_class(cls):
         setup_test_search_index()
         CreateTestData.create()
-        cls.solr = solr.SolrConnection(config.get('solr_url'))
-        cls.fq = " +site_id:\"%s\" " % config.get('ckan.site_id')
+        cls.solr = search.make_connection()
+        cls.fq = " +site_id:\"%s\" " % config['ckan.site_id']
 
     @classmethod
     def teardown_class(cls):
@@ -79,8 +86,8 @@
     def setup_class(cls):
         setup_test_search_index()
         CreateTestData.create_search_test_data()
-        cls.solr = solr.SolrConnection(config.get('solr_url'))
-        cls.fq = " +site_id:\"%s\" " % config.get('ckan.site_id')
+        cls.solr = search.make_connection()
+        cls.fq = " +site_id:\"%s\" " % config['ckan.site_id']
         search.rebuild()
 
     @classmethod


--- a/test-core.ini	Tue Sep 27 10:24:38 2011 +0100
+++ b/test-core.ini	Tue Sep 27 17:11:42 2011 +0100
@@ -19,7 +19,7 @@
 ckan.tests.functional.test_cache.expires = 1800
 ckan.tests.functional.test_cache.TestCacheBasics.test_get_cache_expires.expires = 3600
 
-ckan.site_id = ckan_test
+#ckan.site_id = ckan_test
 ckan.site_title = CKAN
 ckan.site_logo = /images/ckan_logo_fullname_long.png
 package_form = standard

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list