From dee94765951bf0a9afdb120db383c2dd344ecfbb Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 14 Nov 2017 20:07:35 -0800 Subject: [PATCH] Added tests and fixes for Elasticsearch 6 --- .travis.yml | 9 ++++----- CHANGELOG.md | 4 ++++ lib/searchkick/query.rb | 4 +++- test/inheritance_test.rb | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index a92f1de..174a167 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ sudo: false language: ruby -rvm: 2.3.1 +rvm: 2.4.2 services: - mongodb - redis-server @@ -20,7 +20,7 @@ gemfile: - test/gemfiles/mongoid5.gemfile - test/gemfiles/mongoid6.gemfile env: - - ELASTICSEARCH_VERSION=5.6.0 + - ELASTICSEARCH_VERSION=6.0.0 jdk: oraclejdk8 matrix: include: @@ -28,12 +28,11 @@ matrix: env: ELASTICSEARCH_VERSION=2.0.0 jdk: oraclejdk7 - gemfile: Gemfile - env: ELASTICSEARCH_VERSION=2.4.3 + env: ELASTICSEARCH_VERSION=2.4.6 jdk: oraclejdk7 - gemfile: Gemfile env: ELASTICSEARCH_VERSION=5.0.1 jdk: oraclejdk8 - allow_failures: - gemfile: Gemfile - env: ELASTICSEARCH_VERSION=6.0.0-beta1 + env: ELASTICSEARCH_VERSION=5.6.4 jdk: oraclejdk8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d3aa51..f2bcdc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.3.3 [unreleased] + +- Fixed `similar` for Elasticsearch 6 + ## 2.3.2 - Added `_all` and `default_fields` options diff --git a/lib/searchkick/query.rb b/lib/searchkick/query.rb index 9306e9a..2920202 100644 --- a/lib/searchkick/query.rb +++ b/lib/searchkick/query.rb @@ -233,7 +233,7 @@ module Searchkick if options[:similar] payload = { more_like_this: { - like_text: term, + like: term, min_doc_freq: 1, min_term_freq: 1, analyzer: "searchkick_search2" @@ -515,6 +515,8 @@ module Searchkick ["_all"] elsif all && default_match == :phrase ["_all.phrase"] + elsif term == "*" + [] else raise ArgumentError, "Must specify fields to search" end diff --git a/test/inheritance_test.rb b/test/inheritance_test.rb index a0d1d9a..07d24ef 100644 --- a/test/inheritance_test.rb +++ b/test/inheritance_test.rb @@ -2,7 +2,7 @@ require_relative "test_helper" class InheritanceTest < Minitest::Test def setup - skip if defined?(Cequel) + skip if defined?(Cequel) || !elasticsearch_below60? super end -- libgit2 0.21.0