Commit dee94765951bf0a9afdb120db383c2dd344ecfbb

Authored by Andrew
1 parent 076a2dba

Added tests and fixes for Elasticsearch 6

1 sudo: false 1 sudo: false
2 language: ruby 2 language: ruby
3 -rvm: 2.3.1 3 +rvm: 2.4.2
4 services: 4 services:
5 - mongodb 5 - mongodb
6 - redis-server 6 - redis-server
@@ -20,7 +20,7 @@ gemfile: @@ -20,7 +20,7 @@ gemfile:
20 - test/gemfiles/mongoid5.gemfile 20 - test/gemfiles/mongoid5.gemfile
21 - test/gemfiles/mongoid6.gemfile 21 - test/gemfiles/mongoid6.gemfile
22 env: 22 env:
23 - - ELASTICSEARCH_VERSION=5.6.0 23 + - ELASTICSEARCH_VERSION=6.0.0
24 jdk: oraclejdk8 24 jdk: oraclejdk8
25 matrix: 25 matrix:
26 include: 26 include:
@@ -28,12 +28,11 @@ matrix: @@ -28,12 +28,11 @@ matrix:
28 env: ELASTICSEARCH_VERSION=2.0.0 28 env: ELASTICSEARCH_VERSION=2.0.0
29 jdk: oraclejdk7 29 jdk: oraclejdk7
30 - gemfile: Gemfile 30 - gemfile: Gemfile
31 - env: ELASTICSEARCH_VERSION=2.4.3 31 + env: ELASTICSEARCH_VERSION=2.4.6
32 jdk: oraclejdk7 32 jdk: oraclejdk7
33 - gemfile: Gemfile 33 - gemfile: Gemfile
34 env: ELASTICSEARCH_VERSION=5.0.1 34 env: ELASTICSEARCH_VERSION=5.0.1
35 jdk: oraclejdk8 35 jdk: oraclejdk8
36 - allow_failures:  
37 - gemfile: Gemfile 36 - gemfile: Gemfile
38 - env: ELASTICSEARCH_VERSION=6.0.0-beta1 37 + env: ELASTICSEARCH_VERSION=5.6.4
39 jdk: oraclejdk8 38 jdk: oraclejdk8
  1 +## 2.3.3 [unreleased]
  2 +
  3 +- Fixed `similar` for Elasticsearch 6
  4 +
1 ## 2.3.2 5 ## 2.3.2
2 6
3 - Added `_all` and `default_fields` options 7 - Added `_all` and `default_fields` options
lib/searchkick/query.rb
@@ -233,7 +233,7 @@ module Searchkick @@ -233,7 +233,7 @@ module Searchkick
233 if options[:similar] 233 if options[:similar]
234 payload = { 234 payload = {
235 more_like_this: { 235 more_like_this: {
236 - like_text: term, 236 + like: term,
237 min_doc_freq: 1, 237 min_doc_freq: 1,
238 min_term_freq: 1, 238 min_term_freq: 1,
239 analyzer: "searchkick_search2" 239 analyzer: "searchkick_search2"
@@ -515,6 +515,8 @@ module Searchkick @@ -515,6 +515,8 @@ module Searchkick
515 ["_all"] 515 ["_all"]
516 elsif all && default_match == :phrase 516 elsif all && default_match == :phrase
517 ["_all.phrase"] 517 ["_all.phrase"]
  518 + elsif term == "*"
  519 + []
518 else 520 else
519 raise ArgumentError, "Must specify fields to search" 521 raise ArgumentError, "Must specify fields to search"
520 end 522 end
test/inheritance_test.rb
@@ -2,7 +2,7 @@ require_relative "test_helper" @@ -2,7 +2,7 @@ require_relative "test_helper"
2 2
3 class InheritanceTest < Minitest::Test 3 class InheritanceTest < Minitest::Test
4 def setup 4 def setup
5 - skip if defined?(Cequel) 5 + skip if defined?(Cequel) || !elasticsearch_below60?
6 super 6 super
7 end 7 end
8 8