From 2d1e21314f1d501607d4e2ec90173d124c206c59 Mon Sep 17 00:00:00 2001 From: Petar Efnushev Date: Tue, 3 Nov 2020 08:43:05 +0100 Subject: [PATCH] Remove quotes from search query to improve search experience and avoid literal searches --- ckanext/knowledgehub/lib/solr.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ckanext/knowledgehub/lib/solr.py b/ckanext/knowledgehub/lib/solr.py index 15592a8e..0c52f51a 100644 --- a/ckanext/knowledgehub/lib/solr.py +++ b/ckanext/knowledgehub/lib/solr.py @@ -45,6 +45,12 @@ def _to_pysolr_arg(value): query['fq'] = [] query['fq'] = _to_pysolr_arg(query['fq']) + # remove quotes from query to avoid literal searches + # i.e. text:"trends funding" -> text:trends funding + q = query.pop('q', 'text:*') + q = q.replace('"', '') + query['q'] = q + return query