Skip to content

Instantly share code, notes, and snippets.

@secobarbital
Created March 27, 2010 01:43
Show Gist options
  • Save secobarbital/345623 to your computer and use it in GitHub Desktop.
Save secobarbital/345623 to your computer and use it in GitHub Desktop.
module Solr
class Connection
def post_with_response_debug(request)
response = post_without_response_debug(request)
if ENV["DEBUG"]
puts "-- RESPONSE -------------------"
puts response.class
puts response.inspect
puts "-- END RESPONSE ---------------"
end
response
end
alias_method_chain :post, :response_debug
end
module Response
class Ruby
def initialize_with_hashify_facets(ruby_code)
initialize_without_hashify_facets(ruby_code)
@data["facet_counts"] && @data["facet_counts"]["facet_fields"] && @data["facet_counts"]["facet_fields"].each do |k, v|
@data["facet_counts"]["facet_fields"][k] = Hash[*v] if v.is_a?(Array)
end
end
alias_method_chain :initialize, :hashify_facets
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment