From c338452872f2dcd2973794b2778c90bd66d1ea1b Mon Sep 17 00:00:00 2001 From: Mikko Koho Date: Thu, 21 Nov 2013 14:14:56 +0200 Subject: [PATCH 1/2] Put harvest_source_id in quotes to prevent Solr errors --- ckanext/harvest/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/harvest/helpers.py b/ckanext/harvest/helpers.py index 4c7dfb6..b372064 100644 --- a/ckanext/harvest/helpers.py +++ b/ckanext/harvest/helpers.py @@ -18,7 +18,7 @@ def package_list_for_source(source_id): ''' limit = 20 page = int(request.params.get('page', 1)) - fq = 'harvest_source_id:{0}'.format(source_id) + fq = 'harvest_source_id:"{0}"'.format(source_id) search_dict = { 'fq' : fq, 'rows': limit, From 51e842ee6ef23f6181f1e73c2847211624c9b957 Mon Sep 17 00:00:00 2001 From: Mikko Koho Date: Fri, 22 Nov 2013 11:01:26 +0200 Subject: [PATCH 2/2] Add quotes to harvest_source_id in Solr query when clearing harvest sources --- ckanext/harvest/logic/action/update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/harvest/logic/action/update.py b/ckanext/harvest/logic/action/update.py index 5af1e10..d647674 100644 --- a/ckanext/harvest/logic/action/update.py +++ b/ckanext/harvest/logic/action/update.py @@ -156,7 +156,7 @@ def harvest_source_index_clear(context,data_dict): harvest_source_id = source.id conn = make_connection() - query = ''' +%s:%s +site_id:"%s" ''' % ('harvest_source_id', harvest_source_id, + query = ''' +%s:"%s" +site_id:"%s" ''' % ('harvest_source_id', harvest_source_id, config.get('ckan.site_id')) try: conn.delete_query(query)