Skip to content

Commit

Permalink
Add quotes to package ID and name in Solr queries to prevent Solr err…
Browse files Browse the repository at this point in the history
…ors with custom dataset identifiers.
  • Loading branch information
razz0 authored and amercader committed Aug 1, 2014
1 parent c97cd22 commit 8de84e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ckan/lib/search/query.py
Expand Up @@ -264,7 +264,7 @@ def get_all_entity_ids(self, max_results=1000):
def get_index(self,reference):
query = {
'rows': 1,
'q': 'name:%s OR id:%s' % (reference,reference),
'q': 'name:"%s" OR id:"%s"' % (reference,reference),
'wt': 'json',
'fq': 'site_id:"%s"' % config.get('ckan.site_id')}

Expand Down
2 changes: 1 addition & 1 deletion ckan/logic/action/update.py
Expand Up @@ -1174,7 +1174,7 @@ def process_solr(q):
count = 0
q = []
for id in datasets:
q.append('id:%s' % (id))
q.append('id:"%s"' % (id))
count += 1
if count % BATCH_SIZE == 0:
process_solr(' OR '.join(q))
Expand Down

0 comments on commit 8de84e8

Please sign in to comment.