Commit 44b15d7eb5f7a61b2b54c1acbbe1728d0a522ebc

Authored by Andrew Kane
1 parent ccf53e90

Fixed models

lib/searchkick/relation.rb
@@ -9,7 +9,7 @@ module Searchkick @@ -9,7 +9,7 @@ module Searchkick
9 :took, :error, :model_name, :entry_name, :total_count, :total_entries, 9 :took, :error, :model_name, :entry_name, :total_count, :total_entries,
10 :current_page, :per_page, :limit_value, :total_pages, :num_pages, 10 :current_page, :per_page, :limit_value, :total_pages, :num_pages,
11 :offset_value, :previous_page, :prev_page, :next_page, :first_page?, :last_page?, 11 :offset_value, :previous_page, :prev_page, :next_page, :first_page?, :last_page?,
12 - :out_of_range?, :hits, :response, :to_a, :first, :highlights 12 + :out_of_range?, :hits, :response, :to_a, :first, :highlights, :group_by
13 13
14 def_delegators :query, :body, :params 14 def_delegators :query, :body, :params
15 15
@@ -404,7 +404,8 @@ module Searchkick @@ -404,7 +404,8 @@ module Searchkick
404 end 404 end
405 405
406 def spawn 406 def spawn
407 - Relation.new(klass, term, options.deep_dup) 407 + # cannot deep dup due to model classes
  408 + Relation.new(klass, term, options.dup)
408 end 409 end
409 end 410 end
410 end 411 end
test/boost_test.rb
@@ -238,7 +238,6 @@ class BoostTest < Minitest::Test @@ -238,7 +238,6 @@ class BoostTest < Minitest::Test
238 238
239 assert_order "Rex", ["Rexx", "Rex"], {models: [Animal, Product], indices_boost: {Animal => 1, Product => 200}, fields: [:name]}, Searchkick 239 assert_order "Rex", ["Rexx", "Rex"], {models: [Animal, Product], indices_boost: {Animal => 1, Product => 200}, fields: [:name]}, Searchkick
240 240
241 - skip "Not working yet"  
242 assert_order_relation ["Rexx", "Rex"], Searchkick.search("Rex", relation: true).models(Animal, Product).indices_boost(Animal => 1, Product => 200).fields(:name) 241 assert_order_relation ["Rexx", "Rex"], Searchkick.search("Rex", relation: true).models(Animal, Product).indices_boost(Animal => 1, Product => 200).fields(:name)
243 end 242 end
244 end 243 end
test/sql_test.rb
@@ -256,8 +256,6 @@ class SqlTest < Minitest::Test @@ -256,8 +256,6 @@ class SqlTest < Minitest::Test
256 assert records.first.association(associations[klass].first).loaded? 256 assert records.first.association(associations[klass].first).loaded?
257 end 257 end
258 258
259 - skip "Not working yet"  
260 -  
261 result = Searchkick.search("*", relation: true).models(Product, Store).model_includes(associations) 259 result = Searchkick.search("*", relation: true).models(Product, Store).model_includes(associations)
262 assert_equal 2, result.length 260 assert_equal 2, result.length
263 result.group_by(&:class).each_pair do |klass, records| 261 result.group_by(&:class).each_pair do |klass, records|