Commit 5a00e6bbab06230938a0d03c82ba8f230d2c386c

Authored by Andrew Kane
1 parent 579b0908

Use symbols to be consistent

lib/searchkick/results.rb
@@ -67,7 +67,7 @@ module Searchkick @@ -67,7 +67,7 @@ module Searchkick
67 each_with_hit.map do |model, hit| 67 each_with_hit.map do |model, hit|
68 details = {} 68 details = {}
69 if hit["highlight"] 69 if hit["highlight"]
70 - details[:highlight] = Hash[ hit["highlight"].map{|k, v| [options[:json] ? k : k.sub(/\.analyzed\z/, "").to_sym, v.first] } ] 70 + details[:highlight] = Hash[ hit["highlight"].map{|k, v| [(options[:json] ? k : k.sub(/\.analyzed\z/, "")).to_sym, v.first] } ]
71 end 71 end
72 [model, details] 72 [model, details]
73 end 73 end
test/highlight_test.rb
@@ -35,7 +35,7 @@ class TestHighlight < Minitest::Unit::TestCase @@ -35,7 +35,7 @@ class TestHighlight < Minitest::Unit::TestCase
35 } 35 }
36 } 36 }
37 } 37 }
38 - assert_equal "Two Door <strong>Cinema</strong> Club", Product.search(json: json).with_details.first[1][:highlight]["name.analyzed"] 38 + assert_equal "Two Door <strong>Cinema</strong> Club", Product.search(json: json).with_details.first[1][:highlight][:"name.analyzed"]
39 end 39 end
40 40
41 end 41 end