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

Bitbucket commits-noreply at bitbucket.org
Wed Aug 31 19:23:02 UTC 2011


2 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/0d2468843fc0/
changeset:   0d2468843fc0
branch:      feature-1275-solr-search
user:        John Glover
date:        2011-08-31 21:09:06
summary:     [solr] [1277] Bug fix: add facet terms to search query
affected #:  1 file (6 bytes)

--- a/ckan/controllers/package.py	Wed Aug 31 19:09:24 2011 +0100
+++ b/ckan/controllers/package.py	Wed Aug 31 20:09:06 2011 +0100
@@ -106,7 +106,7 @@
         except NotAuthorized:
             abort(401, _('Not authorized to see this page'))
 
-        q = c.q = request.params.get('q') # unicode format (decoded from utf8)
+        q = c.q = request.params.get('q', u'') # unicode format (decoded from utf8)
         c.open_only = request.params.get('open_only', 0)
         c.downloadable_only = request.params.get('downloadable_only', 0)
         c.query_error = False
@@ -139,12 +139,12 @@
             return search_url(params)
 
         try:
-            # TODO: should c.fields be added to the data_dict?
             c.fields = []
             for (param, value) in request.params.items():
                 if not param in ['q', 'open_only', 'downloadable_only', 'page'] \
                         and len(value) and not param.startswith('_'):
                     c.fields.append((param, value))
+                    q += " %s: %s" % (param, value)
 
             context = {'model': model, 'session': model.Session,
                        'user': c.user or c.author}


http://bitbucket.org/okfn/ckan/changeset/cff861e48e3e/
changeset:   cff861e48e3e
branch:      feature-1275-solr-search
user:        John Glover
date:        2011-08-31 21:21:39
summary:     [solr] Remove 'search_enabled' config setting that hid search bars, not useful now that cannot add packages if Solr is missing
affected #:  7 files (805 bytes)

--- a/ckan/config/environment.py	Wed Aug 31 20:09:06 2011 +0100
+++ b/ckan/config/environment.py	Wed Aug 31 20:21:39 2011 +0100
@@ -73,9 +73,6 @@
             ckan_host, port = ckan_host.split(':')
         config['ckan.site_id'] = ckan_host
 
-    # hide search widgets if search is not enabled (save as boolean)
-    config['search_enabled'] = config.get('search_enabled', '').lower() != 'false'
-    
     config['routes.map'] = make_map()
     config['pylons.app_globals'] = app_globals.Globals()
     config['pylons.h'] = ckan.lib.helpers


--- a/ckan/lib/app_globals.py	Wed Aug 31 20:09:06 2011 +0100
+++ b/ckan/lib/app_globals.py	Wed Aug 31 20:21:39 2011 +0100
@@ -30,8 +30,6 @@
 
         self.template_footer_end = config.get('ckan.template_footer_end', '')
 
-        self.search_enabled = config.get('search_enabled', True)
-        
         # hide these extras fields on package read
         self.package_hide_extras = config.get('package_hide_extras', '').split()
 


--- a/ckan/lib/search/common.py	Wed Aug 31 20:09:06 2011 +0100
+++ b/ckan/lib/search/common.py	Wed Aug 31 20:21:39 2011 +0100
@@ -25,12 +25,6 @@
 
     return True
 
-def is_enabled():
-    """
-    Return true if search is enabled in ckan config.
-    """
-    return config.get('search_enabled', True)
-
 def make_connection():
     if solr_user is not None and solr_password is not None:
         return SolrConnection(solr_url, http_user=solr_user, http_pass=solr_password)


--- a/ckan/lib/search/index.py	Wed Aug 31 20:09:06 2011 +0100
+++ b/ckan/lib/search/index.py	Wed Aug 31 20:21:39 2011 +0100
@@ -1,7 +1,7 @@
 from pylons import config
 import itertools
 import string
-from common import SearchIndexError, is_enabled, make_connection
+from common import SearchIndexError, make_connection
 import logging
 log = logging.getLogger(__name__)
 
@@ -82,7 +82,7 @@
         self.index_package(pkg_dict)
 
     def index_package(self, pkg_dict):
-        if (not is_enabled()) or (pkg_dict is None):  
+        if pkg_dict is None:  
             return 
 
         if (not pkg_dict.get('state')) or ('active' not in pkg_dict.get('state')):
@@ -145,9 +145,6 @@
         log.debug("Updated index for %s" % pkg_dict.get('name'))
 
     def delete_package(self, pkg_dict):
-        if not is_enabled():
-            return
-
         conn = make_connection()
         query = "+%s:%s +id:\"%s\" +site_id:\"%s\"" % (TYPE_FIELD, PACKAGE_TYPE,
                                                        pkg_dict.get('id'),


--- a/ckan/templates/home/index.html	Wed Aug 31 20:09:06 2011 +0100
+++ b/ckan/templates/home/index.html	Wed Aug 31 20:21:39 2011 +0100
@@ -48,13 +48,13 @@
       especially in ways that are machine automatable.
     </p>
     
-    <div py:if="g.search_enabled">
+    <div><p py:if="not c.query_error" i18n:msg="package_count"><strong>${c.package_count} registered data packages</strong> available.</p><xi:include href="../package/search_form.html" /></div>
     
-    <py:if test="len(c.facets.get('tags', {})) and g.search_enabled">
+    <py:if test="len(c.facets.get('tags', {}))"><h4>Top Tags</h4><div id="tagcloud"><py:for each="tag_name, count in c.facets.get('tags', {}).items()">


--- a/ckan/templates/layout_base.html	Wed Aug 31 20:09:06 2011 +0100
+++ b/ckan/templates/layout_base.html	Wed Aug 31 20:21:39 2011 +0100
@@ -83,7 +83,7 @@
         </span></div>
 
-      <div class="search-form" py:if="g.search_enabled">
+      <div class="search-form"><form action="${url(controller='package', action='search')}" method="GET"><input type="search" class="search" name="q" value="" autocomplete="off" results="5" placeholder="Search..."/></form>
@@ -97,7 +97,7 @@
       <div class="menu"><ul><li>${h.nav_link(c, _('Home'), controller='home', action='index', id=None)}</li>
-          <li py:if="g.search_enabled">${h.nav_link(c, _('Search'), controller='package', action='index', id=None, highlight_actions = 'search index')}</li>
+          <li>${h.nav_link(c, _('Search'), controller='package', action='index', id=None, highlight_actions = 'search index')}</li><?python
 access_package_create = h.check_access('package_create')
 ?>
@@ -167,7 +167,7 @@
           <h3 class="widget-title">Packages</h3><div class="textwidget"><ul>
-                <li py:if="g.search_enabled">${h.nav_link(c, _('Search'), controller='package', action='search', id=None)}</li>                
+                <li>${h.nav_link(c, _('Search'), controller='package', action='search', id=None)}</li><li py:if="access_package_create">${h.nav_link(c, _('Register a new Package'), controller='package', action='new', id=None)}</li><li>${h.nav_link(c, _('Revision History'), controller='revision', action='index', id=None)}</li><li>${h.link_to(_('API'), h.url_for(controller='api', action='get_api', id=None))}</li>


--- a/doc/configuration.rst	Wed Aug 31 20:09:06 2011 +0100
+++ b/doc/configuration.rst	Wed Aug 31 20:21:39 2011 +0100
@@ -389,20 +389,6 @@
 
 Optionally, ``solr_user`` and ``solr_password`` can also be passed along to specify HTTP Basic authentication details for all Solr requests. 
 
-.. index::
-   single: search_enabled
-
-search_enabled
-^^^^^^^^^^^^^^
-
-Example::
-
- search_enabled = False
- 
-Optional. Default = True.
-
-This allows you to hide the search widgets and disables indexing of packages if it is set to False.
-
 
 Site Settings
 -------------

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