Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-ascii values in the query. #179

Merged
merged 1 commit into from
Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog

- Fixed React widget to add cookies while fetching @search endpoint
[sneridagh]
- Handle non-ascii values in the query. [reinhardt]

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

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