Commit 44b15d7eb5f7a61b2b54c1acbbe1728d0a522ebc

Authored by Andrew Kane
1 parent ccf53e90

Fixed models

lib/searchkick/relation.rb
... ... @@ -9,7 +9,7 @@ module Searchkick
9 9 :took, :error, :model_name, :entry_name, :total_count, :total_entries,
10 10 :current_page, :per_page, :limit_value, :total_pages, :num_pages,
11 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 14 def_delegators :query, :body, :params
15 15  
... ... @@ -404,7 +404,8 @@ module Searchkick
404 404 end
405 405  
406 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 409 end
409 410 end
410 411 end
... ...
test/boost_test.rb
... ... @@ -238,7 +238,6 @@ class BoostTest < Minitest::Test
238 238  
239 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 241 assert_order_relation ["Rexx", "Rex"], Searchkick.search("Rex", relation: true).models(Animal, Product).indices_boost(Animal => 1, Product => 200).fields(:name)
243 242 end
244 243 end
... ...
test/sql_test.rb
... ... @@ -256,8 +256,6 @@ class SqlTest < Minitest::Test
256 256 assert records.first.association(associations[klass].first).loaded?
257 257 end
258 258  
259   - skip "Not working yet"
260   -
261 259 result = Searchkick.search("*", relation: true).models(Product, Store).model_includes(associations)
262 260 assert_equal 2, result.length
263 261 result.group_by(&:class).each_pair do |klass, records|
... ...