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 67 each_with_hit.map do |model, hit|
68 68 details = {}
69 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 71 end
72 72 [model, details]
73 73 end
... ...
test/highlight_test.rb
... ... @@ -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 39 end
40 40  
41 41 end
... ...