Skip to content

Commit

Permalink
Minor cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
alindeman committed Dec 10, 2011
1 parent 3c7f72d commit 9f97f8c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions sunspot/lib/sunspot/query/dismax.rb
Expand Up @@ -64,7 +64,7 @@ def to_subquery
params.delete :defType
params.delete :fl
keywords = params.delete(:q)
options = params.map { |key, value| escape_param(key, value)}.join(' ')
options = params.map { |key, value| escape_param(key, value) }.join(' ')
"_query_:\"{!dismax #{options}}#{escape_quotes(keywords)}\""
end

Expand Down Expand Up @@ -119,10 +119,7 @@ def has_fulltext_field?(field)
private

def escape_param(key, value)
escaped_param = []
value = [value] unless value.respond_to? :each
escaped_param = "#{key}='#{escape_quotes(value.join(" "))}'"
return escaped_param
"#{key}='#{escape_quotes(Array(value).join(" "))}'"
end

def escape_quotes(value)
Expand Down

0 comments on commit 9f97f8c

Please sign in to comment.