Permalink
Browse files

allow SearchableText query to be a dictionary

  • Loading branch information...
1 parent 90841fd commit ed3c88a3fd12063592c70d82c6d59d97bf70b409 @gweis committed Mar 14, 2012
Showing with 13 additions and 3 deletions.
  1. +13 −3 src/collective/solr/utils.py
@@ -54,9 +54,19 @@ def prepareData(data):
data['Language'] = [lang or 'any' for lang in language]
searchable = data.get('SearchableText', None)
if searchable is not None:
- if isinstance(searchable, unicode):
- searchable = searchable.encode('utf-8')
- data['SearchableText'] = searchable.translate(translation_map)
+ # SearchableText might also be adict {'query': '', ....}
+ if isinstance(searchable, dict):
+ query = searchable['query']
+ else:
+ query = searchable
+ if isinstance(query, unicode):
+ query = searchable.encode('utf-8')
+ query = query.translate(translation_map)
+ if isinstance(searchable, dict):
+ searchable['query'] = query
+ else:
+ searchable = query
+ data['SearchableText'] = searchable
simpleTerm = compile(r'^[\w\d]+$', UNICODE)

0 comments on commit ed3c88a

Please sign in to comment.