[ckan-changes] commit/ckanext-solr: 3 new changesets
Bitbucket
commits-noreply at bitbucket.org
Thu Aug 11 11:03:15 UTC 2011
3 new changesets in ckanext-solr:
http://bitbucket.org/okfn/ckanext-solr/changeset/782ffd25c6a3/
changeset: 782ffd25c6a3
user: John Glover
date: 2011-08-11 13:01:53
summary: Fix formatting
affected #: 1 file (3 bytes)
--- a/README.md Wed Aug 10 17:59:41 2011 +0100
+++ b/README.md Thu Aug 11 12:01:53 2011 +0100
@@ -22,7 +22,7 @@
server (even in queue mode, queries are still dispatched directly). To configure
CKAN to use ckanext-solr, first install the extension::
- $ pip install -e hg+https://bitbucket.org/okfn/ckanext-solr#egg=ckanext-solr
+ $ pip install -e hg+https://bitbucket.org/okfn/ckanext-solr#egg=ckanext-solr
This will download the code and register all entry points. You can then add the
following configuration options in your CKAN site configuration file::
http://bitbucket.org/okfn/ckanext-solr/changeset/8ac622a1e85a/
changeset: 8ac622a1e85a
user: John Glover
date: 2011-08-11 13:02:27
summary: Remove duplicate ckan.site_url var
affected #: 1 file (110 bytes)
--- a/test.ini Thu Aug 11 12:01:53 2011 +0100
+++ b/test.ini Thu Aug 11 12:02:27 2011 +0100
@@ -77,10 +77,6 @@
## Site tagline / description (used on front page)
ckan.site_description =
-## Used in creating some absolute urls (such as rss feeds, css files) and
-## dump filenames
-ckan.site_url =
-
## Favicon (default is the CKAN software favicon)
ckan.favicon = http://assets.okfn.org/p/ckan/img/ckan.ico
http://bitbucket.org/okfn/ckanext-solr/changeset/d6484cdb0437/
changeset: d6484cdb0437
user: John Glover
date: 2011-08-11 13:02:48
summary: Add basic solr search tests
affected #: 1 file (1.1 KB)
--- a/tests/test_search_index.py Thu Aug 11 12:02:27 2011 +0100
+++ b/tests/test_search_index.py Thu Aug 11 12:02:48 2011 +0100
@@ -1,8 +1,6 @@
-import time
-import sqlalchemy as sa
import solr
from pylons import config
-from ckan.tests import *
+from ckan.tests import TestController, CreateTestData
from ckan import model
import ckan.lib.search as search
from ckanext.solr.backend import SolrSearchBackend
@@ -34,10 +32,12 @@
def setup_class(cls):
CreateTestData.create()
cls.solr = solr.SolrConnection(config.get('solr_url'))
+ cls.fq = " +site_id:\"%s\" " % config.get('ckan.site_id')
@classmethod
def teardown_class(cls):
model.repo.rebuild_db()
+ cls.solr.close()
def teardown(self):
# clear the search index after every test
@@ -50,7 +50,7 @@
'state': u'active'
}
search.dispatch_by_operation('Package', pkg_dict, 'new')
- response = self.solr.query('title:penguin')
+ response = self.solr.query('title:penguin', fq=self.fq)
assert len(response) == 1, len(response)
assert response.results[0]['title'] == 'penguin'
@@ -59,7 +59,7 @@
'title': 'penguin'
}
search.dispatch_by_operation('Package', pkg_dict, 'new')
- response = self.solr.query('title:penguin')
+ response = self.solr.query('title:penguin', fq=self.fq)
assert len(response) == 0, len(response)
def test_index_clear(self):
@@ -69,9 +69,39 @@
'state': u'active'
}
search.dispatch_by_operation('Package', pkg_dict, 'new')
- response = self.solr.query('title:penguin')
+ response = self.solr.query('title:penguin', fq=self.fq)
assert len(response) == 1, len(response)
search.get_backend().index_for('Package').clear()
- response = self.solr.query('title:penguin')
+ response = self.solr.query('title:penguin', fq=self.fq)
assert len(response) == 0
+
+class TestSolrSearch:
+ @classmethod
+ def setup_class(cls):
+ CreateTestData.create_search_test_data()
+ cls.solr = solr.SolrConnection(config.get('solr_url'))
+ cls.fq = " +site_id:\"%s\" " % config.get('ckan.site_id')
+ search.rebuild()
+
+ @classmethod
+ def teardown_class(cls):
+ model.repo.rebuild_db()
+ cls.solr.close()
+ search.get_backend().index_for('Package').clear()
+
+ def test_0_indexing(self):
+ """
+ Make sure that all packages created by CreateTestData.create_search_test_data
+ have been added to the search index.
+ """
+ results = self.solr.query('*:*', fq=self.fq)
+ assert len(results) == 6, len(results)
+
+ def test_1_basic(self):
+ results = self.solr.query('sweden', fq=self.fq)
+ assert len(results) == 2
+ result_names = [r['name'] for r in results]
+ assert 'se-publications' in result_names
+ assert 'se-opengov' in result_names
+
Repository URL: https://bitbucket.org/okfn/ckanext-solr/
--
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