Skip to content

Commit

Permalink
Handle non-ascii values in the query.
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhardt committed Jul 12, 2017
1 parent b561fb7 commit e81144b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog
6.0a2 (unreleased)
------------------

- Handle non-ascii values in the query. [reinhardt]

- solr.cfg: configure JMX host and port separately. [maurits]

- Added link to Solr sync in our control panel. Added titles to all
Expand Down
4 changes: 3 additions & 1 deletion src/collective/solr/search.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from Missing import MV
from Products.CMFPlone.utils import safe_unicode
from collective.solr.exceptions import SolrInactiveException
from collective.solr.interfaces import ISearch
from collective.solr.interfaces import ISolrConnectionManager
Expand Down Expand Up @@ -84,7 +85,8 @@ def search(self, query, **parameters):
else:
parameters['fl'] = '* score'
if isinstance(query, dict):
query = ' '.join(query.values())
query = u' '.join([
safe_unicode(val) for val in query.values()]).encode('utf-8')
logger.debug('searching for %r (%r)', query, parameters)
if 'sort' in parameters: # issue warning for unknown sort indices
index, order = parameters['sort'].split()
Expand Down

0 comments on commit e81144b

Please sign in to comment.