Commit 3dc4776bb69b5f2c59d29f48fd7edf618d887ee9

Authored by Andrew Kane
1 parent 6088da6d

Fixes for ES6 beta1

.travis.yml
... ... @@ -33,6 +33,7 @@ matrix:
33 33 - gemfile: Gemfile
34 34 env: ELASTICSEARCH_VERSION=5.0.1
35 35 jdk: oraclejdk8
  36 + allow_failures:
36 37 - gemfile: Gemfile
37   - env: ELASTICSEARCH_VERSION=6.0.0-alpha2
  38 + env: ELASTICSEARCH_VERSION=6.0.0-beta1
38 39 jdk: oraclejdk8
... ...
lib/searchkick/index.rb
... ... @@ -15,7 +15,13 @@ module Searchkick
15 15 end
16 16  
17 17 def delete
18   - client.indices.delete index: name
  18 + if !Searchkick.server_below?("6.0.0-alpha1") && alias_exists?
  19 + # can't call delete directly on aliases in ES 6
  20 + indices = client.indices.get_alias(name: name).keys
  21 + client.indices.delete index: indices
  22 + else
  23 + client.indices.delete index: name
  24 + end
19 25 end
20 26  
21 27 def exists?
... ...
lib/searchkick/index_options.rb
... ... @@ -162,11 +162,6 @@ module Searchkick
162 162 settings[:similarity] = {default: {type: options[:similarity]}}
163 163 end
164 164  
165   - unless below60
166   - settings[:mapping] ||= {}
167   - settings[:mapping][:single_type] = false
168   - end
169   -
170 165 settings.deep_merge!(options[:settings] || {})
171 166  
172 167 # synonyms
... ... @@ -188,7 +183,7 @@ module Searchkick
188 183 # - Only apply the synonym expansion at index time
189 184 # - Don't have the synonym filter applied search
190 185 # - Use directional synonyms where appropriate. You want to make sure that you're not injecting terms that are too general.
191   - settings[:analysis][:analyzer][default_analyzer][:filter].insert(4, "searchkick_synonym")
  186 + settings[:analysis][:analyzer][default_analyzer][:filter].insert(4, "searchkick_synonym") if below60
192 187 settings[:analysis][:analyzer][default_analyzer][:filter] << "searchkick_synonym"
193 188  
194 189 %w(word_start word_middle word_end).each do |type|
... ...
test/highlight_test.rb
... ... @@ -32,7 +32,7 @@ class HighlightTest &lt; Minitest::Test
32 32  
33 33 def test_field_options
34 34 store_names ["Two Door Cinema Club are a Northern Irish indie rock band"]
35   - fragment_size = ENV["MATCH"] == "word_start" ? 26 : 20
  35 + fragment_size = ENV["MATCH"] == "word_start" ? 26 : 21
36 36 assert_equal "Two Door <em>Cinema</em> Club are", Product.search("cinema", fields: [:name], highlight: {fields: {name: {fragment_size: fragment_size}}}).first.search_highlights[:name]
37 37 end
38 38  
... ...