From 420f81e7a51dc898d6b69a522b47c92ad1c94163 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 17 Mar 2020 21:02:58 -0700 Subject: [PATCH] Added indices_boost [skip ci] --- lib/searchkick/relation.rb | 10 ++++++++++ test/boost_test.rb | 3 +++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/lib/searchkick/relation.rb b/lib/searchkick/relation.rb index 091e3b1..4a1dd21 100644 --- a/lib/searchkick/relation.rb +++ b/lib/searchkick/relation.rb @@ -212,6 +212,16 @@ module Searchkick self end + def indices_boost(value) + spawn.indices_boost!(value) + end + + # TODO merge options + def indices_boost!(value) + options[:indices_boost] = value + self + end + # same as Active Record def inspect entries = results.first(11).map!(&:inspect) diff --git a/test/boost_test.rb b/test/boost_test.rb index fa88193..5642109 100644 --- a/test/boost_test.rb +++ b/test/boost_test.rb @@ -237,5 +237,8 @@ class BoostTest < Minitest::Test store_names ["Rexx"], Product assert_order "Rex", ["Rexx", "Rex"], {models: [Animal, Product], indices_boost: {Animal => 1, Product => 200}, fields: [:name]}, Searchkick + + skip "Not working yet" + assert_order_relation ["Rexx", "Rex"], Searchkick.search("Rex", relation: true).models(Animal, Product).indices_boost(Animal => 1, Product => 200).fields(:name) end end -- libgit2 0.21.0