From a430c44639ead7e3606e8c65cf061eeb416dbe4e Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Mon, 7 Dec 2015 23:52:19 -0800 Subject: [PATCH] Do not use all fields when searchable specified --- lib/searchkick/query.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/searchkick/query.rb b/lib/searchkick/query.rb index b4f9c74..b38e2a6 100644 --- a/lib/searchkick/query.rb +++ b/lib/searchkick/query.rb @@ -122,12 +122,13 @@ module Searchkick def prepare boost_fields = {} + fields = options[:fields] || searchkick_options[:searchable] fields = - if options[:fields] + if fields if options[:autocomplete] - options[:fields].map { |f| "#{f}.autocomplete" } + fields.map { |f| "#{f}.autocomplete" } else - options[:fields].map do |value| + fields.map do |value| k, v = value.is_a?(Hash) ? value.to_a.first : [value, options[:match] || searchkick_options[:match] || :word] k2, boost = k.to_s.split("^", 2) field = "#{k2}.#{v == :word ? 'analyzed' : v}" -- libgit2 0.21.0