[ckan-changes] commit/ckan: John Glover: [solr] Update API controller, get action and package functional tests to work with new search

Bitbucket commits-noreply at bitbucket.org
Thu Aug 18 13:45:45 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/6c242053d743/
changeset:   6c242053d743
branch:      feature-1275-solr-search
user:        John Glover
date:        2011-08-18 15:45:27
summary:     [solr] Update API controller, get action and package functional tests to work with new search
affected #:  3 files (252 bytes)

--- a/ckan/controllers/api.py	Thu Aug 18 14:02:12 2011 +0100
+++ b/ckan/controllers/api.py	Thu Aug 18 14:45:27 2011 +0100
@@ -420,9 +420,8 @@
             if register == 'package':
                 options.ref_entity_with_attr = 'id' if ver == '2' else 'name'
             try:
-                backend = None
                 if register == 'resource': 
-                    query = query_for(model.Resource, backend='sql')
+                    query = query_for(model.Resource)
                 else:
                     query = query_for(model.Package)
                 results = query.run(query=params.get('q'), 


--- a/ckan/logic/action/get.py	Thu Aug 18 14:02:12 2011 +0100
+++ b/ckan/logic/action/get.py	Thu Aug 18 14:45:27 2011 +0100
@@ -203,7 +203,7 @@
         offset = data_dict.get('offset',0)
         return_objects = data_dict.get('return_objects',True)
 
-        query = query_for(model.Tag, backend='sql')
+        query = query_for(model.Tag)
         query.run(query=q,
                   limit=limit,
                   offset=offset,
@@ -508,7 +508,7 @@
 
     like_q = u"%s%%" % q
 
-    query = query_for('tag', backend='sql')
+    query = query_for('tag')
     query.run(query=like_q,
               return_objects=True,
               limit=10,


--- a/ckan/tests/functional/test_package.py	Thu Aug 18 14:02:12 2011 +0100
+++ b/ckan/tests/functional/test_package.py	Thu Aug 18 14:45:27 2011 +0100
@@ -10,13 +10,14 @@
 from nose.tools import assert_equal
 
 from ckan.tests import *
-from ckan.tests import search_related
+from ckan.tests import search_related, is_search_supported
 from ckan.tests.html_check import HtmlCheckMethods
 from ckan.tests.pylons_controller import PylonsTestCase
 from base import FunctionalTestCase
 import ckan.model as model
 from ckan.lib.create_test_data import CreateTestData
 import ckan.lib.helpers as h
+import ckan.lib.search as search
 from ckan.controllers.package import PackageController
 from ckan.plugins import SingletonPlugin, implements, IPackageController
 from ckan import plugins
@@ -259,17 +260,22 @@
                     pkg.purge()
                 model.repo.commit_and_remove()
 
-class TestReadOnly(TestPackageForm, HtmlCheckMethods, TestSearchIndexer, PylonsTestCase):
+class TestReadOnly(TestPackageForm, HtmlCheckMethods, PylonsTestCase):
 
     @classmethod
     def setup_class(cls):
+        if not is_search_supported():
+            raise SkipTest("Search not supported")
+
         PylonsTestCase.setup_class()
-        cls.tsi = TestSearchIndexer()
+        search.clear()
+        plugins.load('synchronous_search')
         CreateTestData.create()
 
     @classmethod
     def teardown_class(cls):
         model.repo.rebuild_db()
+        search.clear()
 
     @search_related
     def test_minornavigation_2(self):

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