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

Bitbucket commits-noreply at bitbucket.org
Mon Aug 22 14:08:53 UTC 2011


2 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/c7afea997834/
changeset:   c7afea997834
branch:      feature-1275-solr-search
user:        John Glover
date:        2011-08-22 11:49:10
summary:     [solr] update authz test to use new search functions
affected #:  1 file (14 bytes)

--- a/ckan/tests/functional/test_authz.py	Thu Aug 18 18:18:11 2011 +0100
+++ b/ckan/tests/functional/test_authz.py	Mon Aug 22 10:49:10 2011 +0100
@@ -597,10 +597,9 @@
             model.Session.delete(role_action)
         
         model.repo.commit_and_remove()
-        indexer = TestSearchIndexer()
         TestUsage._create_test_data()
         model.Session.remove()
-        indexer.index()
+        search.rebuild()
         self.user_name = TestUsage.mrloggedin.name.encode('utf-8')
     
     def _check_logged_in_users_authorized_only(self, offset):
@@ -636,3 +635,4 @@
     def teardown_class(self):
         model.repo.rebuild_db()
         model.Session.remove()
+        search.clear()


http://bitbucket.org/okfn/ckan/changeset/c086f25464fa/
changeset:   c086f25464fa
branch:      feature-1275-solr-search
user:        John Glover
date:        2011-08-22 15:51:46
summary:     [solr] bug fixes: fix pass tests in functional/api/test_package_search.py
affected #:  1 file (168 bytes)

--- a/ckan/lib/search/query.py	Mon Aug 22 10:49:10 2011 +0100
+++ b/ckan/lib/search/query.py	Mon Aug 22 14:51:46 2011 +0100
@@ -71,7 +71,7 @@
                 parts.append(term.strip())
                 
             for field, value in self._fields.items():
-                if value.find(' ') != -1:
+                if field != 'tags' and value.find(' ') != -1:
                     value = u"\"%s\"" % value
                 parts.append(u"%s:%s" % (field.strip(), value.strip()))
                 
@@ -203,6 +203,9 @@
         if order_by == 'rank' or order_by is None: 
             order_by = 'score'
 
+        # sort in descending order if sorting by score
+        sort = 'desc' if order_by == 'score' else 'asc'
+
         # show only results from this CKAN instance:
         fq = fq + " +site_id:\"%s\" " % config.get('ckan.site_id')
 
@@ -214,7 +217,7 @@
 
         # query
         query = self.query.query
-        if (not query) or (not query.strip()):
+        if (not query) or (not query.strip()) or (query == '""') or (query == "''"):
             # no query terms, i.e. all documents
             query = '*:*'
         
@@ -230,7 +233,7 @@
                               start=self.options.offset, 
                               rows=self.options.limit,
                               fields='id,score', 
-                              sort_order='desc', 
+                              sort_order=sort, 
                               sort=order_by)
             
         except Exception, e:

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