Skip to content

Commit

Permalink
[solr query] Fixed bug: legacy parameter conversion assumed values we…
Browse files Browse the repository at this point in the history
…re bytestrings.
  • Loading branch information
icmurray committed Nov 15, 2011
1 parent 8faff3c commit 5a90544
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ckan/lib/search/query.py
Expand Up @@ -35,7 +35,7 @@ def convert_legacy_parameters_to_solr(legacy_params):
non_solr_params = set(legacy_params.keys()) - VALID_SOLR_PARAMETERS
for search_key in non_solr_params:
value_obj = legacy_params[search_key]
value = str(value_obj).replace('+', ' ')
value = value_obj.replace('+', ' ') if isinstance(value_obj, basestring) else value_obj
if search_key == 'all_fields':
if value:
solr_params['fl'] = '*'
Expand Down
1 change: 1 addition & 0 deletions ckan/tests/lib/test_solr_package_search.py
Expand Up @@ -26,6 +26,7 @@ def test_1_convert_legacy_params_to_solr(self):
assert_equal(convert({'tags': ['tolstoy']}), {'q': 'tags:"tolstoy"'})
assert_equal(convert({'tags': 'tolstoy'}), {'q': 'tags:"tolstoy"'})
assert_equal(convert({'tags': 'more than one tolstoy'}), {'q': 'tags:"more than one tolstoy"'})
assert_equal(convert({'tags': u'with greek omega \u03a9'}), {'q': u'tags:"with greek omega \u03a9"'})
assert_raises(search.SearchError, convert, {'tags': {'tolstoy':1}})

class TestSearch(TestController):
Expand Down

0 comments on commit 5a90544

Please sign in to comment.