From fb24c8444ab389967596fda626f76e28bb7812ff Mon Sep 17 00:00:00 2001 From: Jari Voutilainen Date: Tue, 31 Jul 2018 09:47:43 +0300 Subject: [PATCH 01/14] Explicitly set default search field in search as schema based default field is deprecated in solr --- ckan/lib/search/query.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ckan/lib/search/query.py b/ckan/lib/search/query.py index 19e26ff1877..e7ddfdcb934 100644 --- a/ckan/lib/search/query.py +++ b/ckan/lib/search/query.py @@ -311,6 +311,9 @@ def run(self, query, permission_labels=None, **kwargs): if not q or q == '""' or q == "''": query['q'] = "*:*" + # Set default search field + query['df'] = 'text' + # number of results rows_to_return = min(1000, int(query.get('rows', 10))) if rows_to_return > 0: From 89cb5097062ac9a286f7b225d992a57cdaa721c8 Mon Sep 17 00:00:00 2001 From: Jari Voutilainen Date: Thu, 2 Aug 2018 16:23:40 +0300 Subject: [PATCH 02/14] Set default search field before before_search and expose it to search itself --- ckan/lib/search/query.py | 5 +---- ckan/logic/action/get.py | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ckan/lib/search/query.py b/ckan/lib/search/query.py index e7ddfdcb934..599125bbe54 100644 --- a/ckan/lib/search/query.py +++ b/ckan/lib/search/query.py @@ -20,7 +20,7 @@ VALID_SOLR_PARAMETERS = set([ 'q', 'fl', 'fq', 'rows', 'sort', 'start', 'wt', 'qf', 'bf', 'boost', 'facet', 'facet.mincount', 'facet.limit', 'facet.field', - 'extras', 'fq_list', 'tie', 'defType', 'mm' + 'extras', 'fq_list', 'tie', 'defType', 'mm', 'df' ]) # for (solr) package searches, this specifies the fields that are searched @@ -311,9 +311,6 @@ def run(self, query, permission_labels=None, **kwargs): if not q or q == '""' or q == "''": query['q'] = "*:*" - # Set default search field - query['df'] = 'text' - # number of results rows_to_return = min(1000, int(query.get('rows', 10))) if rows_to_return > 0: diff --git a/ckan/logic/action/get.py b/ckan/logic/action/get.py index 7c4cd02a453..563346994da 100644 --- a/ckan/logic/action/get.py +++ b/ckan/logic/action/get.py @@ -1814,6 +1814,9 @@ def package_search(context, data_dict): for key in [key for key in data_dict.keys() if key.startswith('ext_')]: data_dict['extras'][key] = data_dict.pop(key) + # set default search field + data_dict.setdefault('df', 'text') + # check if some extension needs to modify the search params for item in plugins.PluginImplementations(plugins.IPackageController): data_dict = item.before_search(data_dict) From 5373525f6a18f3a7922eaf5d50fbeeaae937d7be Mon Sep 17 00:00:00 2001 From: Jari Voutilainen Date: Fri, 3 Aug 2018 08:56:10 +0300 Subject: [PATCH 03/14] Set df parameter so that it can't be manipulated from the api --- ckan/logic/action/get.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckan/logic/action/get.py b/ckan/logic/action/get.py index 563346994da..07a7e2aec0e 100644 --- a/ckan/logic/action/get.py +++ b/ckan/logic/action/get.py @@ -1815,7 +1815,7 @@ def package_search(context, data_dict): data_dict['extras'][key] = data_dict.pop(key) # set default search field - data_dict.setdefault('df', 'text') + data_dict['df'] = 'text' # check if some extension needs to modify the search params for item in plugins.PluginImplementations(plugins.IPackageController): From 56fb0b19db735c4583309fe1e9fdc8eb06364189 Mon Sep 17 00:00:00 2001 From: Dusko Bogdanovski Date: Wed, 15 Aug 2018 13:48:39 +0200 Subject: [PATCH 04/14] [#4401] Fix for comparing the current with the chosen language --- ckan/templates/snippets/language_selector.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckan/templates/snippets/language_selector.html b/ckan/templates/snippets/language_selector.html index bdea7b2ad9e..a092949b349 100644 --- a/ckan/templates/snippets/language_selector.html +++ b/ckan/templates/snippets/language_selector.html @@ -3,7 +3,7 @@