diff --git a/ckan/controllers/package.py b/ckan/controllers/package.py index 5884e8c98c1..ff9082b0d5d 100644 --- a/ckan/controllers/package.py +++ b/ckan/controllers/package.py @@ -239,12 +239,13 @@ def pager_url(q=None, page=None): try: c.fields = [] search_extras = {} + fq = '' for (param, value) in request.params.items(): if not param in ['q', 'page'] \ and len(value) and not param.startswith('_'): if not param.startswith('ext_'): c.fields.append((param, value)) - q += ' %s: "%s"' % (param, value) + fq += ' %s:"%s"' % (param, value) else: search_extras[param] = value @@ -253,6 +254,7 @@ def pager_url(q=None, page=None): data_dict = { 'q':q, + 'fq':fq, 'facet.field':g.facets, 'rows':limit, 'start':(page-1)*limit, diff --git a/ckan/lib/activity.py b/ckan/lib/activity.py index 9bbde7146fe..9fbc1a67e7f 100644 --- a/ckan/lib/activity.py +++ b/ckan/lib/activity.py @@ -92,6 +92,12 @@ def before_commit(self, session): objects = object_cache[activity_type] for obj in objects: logger.debug("Looking at %s object %s" % (activity_type, obj)) + + if not hasattr(obj,"id"): + logger.debug("Object has no id, skipping...") + continue + + if activity_type == "new" and obj.id in activities: logger.debug("This object was already logged as a new " "package") diff --git a/ckan/lib/i18n.py b/ckan/lib/i18n.py index c9691e3f213..743ef880aad 100644 --- a/ckan/lib/i18n.py +++ b/ckan/lib/i18n.py @@ -89,7 +89,8 @@ def get_available_locales(): def handle_request(request, tmpl_context): ''' Set the language for the request ''' - lang = request.environ.get('CKAN_LANG', config['ckan.locale_default']) + lang = request.environ.get('CKAN_LANG', + config.get('ckan.locale_default', 'en')) if lang != 'en': i18n.set_lang(lang) tmpl_context.language = lang diff --git a/ckan/lib/search/query.py b/ckan/lib/search/query.py index 3ad1608f4ea..e4d6dbb6152 100644 --- a/ckan/lib/search/query.py +++ b/ckan/lib/search/query.py @@ -282,13 +282,12 @@ def run(self, query): # return results as json encoded string query['wt'] = query.get('wt', 'json') - # query field weighting: disabled for now as solr 3.* is required for - # the 'edismax' query parser, our current Ubuntu version only has - # packages for 1.4 - # - # query['defType'] = 'edismax' - # query['tie'] = '0.5' - # query['qf'] = query.get('qf', QUERY_FIELDS) + # If the query has a colon in it then consider it a fielded search and do use dismax. + if ':' not in query['q']: + query['defType'] = 'dismax' + query['tie'] = '0.1' + query['mm'] = '1' + query['qf'] = query.get('qf', QUERY_FIELDS) conn = make_connection() log.debug('Package query: %r' % query) diff --git a/ckan/logic/schema.py b/ckan/logic/schema.py index 31988d076b4..b1763501d41 100644 --- a/ckan/logic/schema.py +++ b/ckan/logic/schema.py @@ -188,6 +188,16 @@ def default_group_schema(): 'packages': { "id": [not_empty, unicode, package_id_or_name_exists], "__extras": [ignore] + }, + 'users': { + "name": [not_empty, unicode], + "capacity": [ignore_missing], + "__extras": [ignore] + }, + 'groups': { + "name": [not_empty, unicode], + "capacity": [ignore_missing], + "__extras": [ignore] } } return schema diff --git a/ckan/templates/js_strings.html b/ckan/templates/js_strings.html index 55c056bdc96..513a5c2ad25 100644 --- a/ckan/templates/js_strings.html +++ b/ckan/templates/js_strings.html @@ -22,7 +22,7 @@ CKAN.Strings.failedToSave = "${_('Failed to save, possibly due to invalid data ')}"; CKAN.Strings.addDataset = "${_('Add Dataset')}"; CKAN.Strings.addGroup = "${_('Add Group')}"; - CKAN.Strings.youHaveUnsavedChanges = "${_("You have unsaved changed. Make sure to click 'Save Changes' below before leaving this page.")}"; + CKAN.Strings.youHaveUnsavedChanges = "${_("You have unsaved changes. Make sure to click 'Save Changes' below before leaving this page.")}"; CKAN.Strings.loading = "${_('Loading...')}"; CKAN.Strings.noNameBrackets = "${_('(no name)')}"; CKAN.Strings.deleteThisResourceQuestion = "${_('Delete the resource \'%name%\'?')}" diff --git a/ckan/templates/user/read.html b/ckan/templates/user/read.html index 318b9f12321..43716c66a3f 100644 --- a/ckan/templates/user/read.html +++ b/ckan/templates/user/read.html @@ -21,6 +21,13 @@