Commit f403e4cf1179f10ec66f7f88e7bc0f04d7a005a0

Authored by Andrew Kane
1 parent fc950aad

Fixed error with similar method and _all field

Showing 2 changed files with 4 additions and 1 deletions   Show diff stats
CHANGELOG.md
... ... @@ -2,6 +2,7 @@
2 2  
3 3 - Added `queue_name` option
4 4 - No longer require synonyms to be lowercase
  5 +- Fixed error with `similar` method and `_all` field
5 6  
6 7 ## 2.2.1
7 8  
... ...
lib/searchkick/query.rb
... ... @@ -223,13 +223,15 @@ module Searchkick
223 223 if options[:similar]
224 224 payload = {
225 225 more_like_this: {
226   - fields: fields,
227 226 like_text: term,
228 227 min_doc_freq: 1,
229 228 min_term_freq: 1,
230 229 analyzer: "searchkick_search2"
231 230 }
232 231 }
  232 + if fields != ["_all"]
  233 + payload[:more_like_this][:fields] = fields
  234 + end
233 235 elsif all
234 236 payload = {
235 237 match_all: {}
... ...