Commit 4ca67b70abeea9c0bb5240bc6363b6e7f49d468f

Authored by Andrew Kane
1 parent 37f78b59

Removed wordnet option [skip ci]

CHANGELOG.md
... ... @@ -5,6 +5,7 @@
5 5 - Raise `ArgumentError` (instead of warning) for invalid regular expression modifiers
6 6 - Raise `ArgumentError` instead of `RuntimeError` for unknown operators
7 7 - Removed mapping of `id` to `_id` with `order` option
  8 +- Removed `wordnet` option
8 9 - Dropped support for Ruby < 2.6 and Active Record < 5.2
9 10 - Dropped support for NoBrainer and Cequel
10 11 - Dropped support for `faraday_middleware-aws-signers-v4` (use `faraday_middleware-aws-sigv4` instead)
... ...
lib/searchkick.rb
... ... @@ -39,12 +39,11 @@ module Searchkick
39 39 class ImportError < Error; end
40 40  
41 41 class << self
42   - attr_accessor :search_method_name, :wordnet_path, :timeout, :models, :client_options, :redis, :index_prefix, :index_suffix, :queue_name, :model_options
  42 + attr_accessor :search_method_name, :timeout, :models, :client_options, :redis, :index_prefix, :index_suffix, :queue_name, :model_options
43 43 attr_writer :client, :env, :search_timeout
44 44 attr_reader :aws_credentials
45 45 end
46 46 self.search_method_name = :search
47   - self.wordnet_path = "/var/lib/wn_s.pl"
48 47 self.timeout = 10
49 48 self.models = []
50 49 self.client_options = {}
... ...
lib/searchkick/index_options.rb
... ... @@ -185,8 +185,6 @@ module Searchkick
185 185  
186 186 add_synonyms(settings)
187 187 add_search_synonyms(settings)
188   - # TODO remove in Searchkick 5
189   - add_wordnet(settings) if options[:wordnet]
190 188  
191 189 if options[:special_characters] == false
192 190 settings[:analysis][:analyzer].each_value do |analyzer_settings|
... ... @@ -537,21 +535,6 @@ module Searchkick
537 535 end
538 536 end
539 537  
540   - def add_wordnet(settings)
541   - settings[:analysis][:filter][:searchkick_wordnet] = {
542   - type: "synonym",
543   - format: "wordnet",
544   - synonyms_path: Searchkick.wordnet_path
545   - }
546   -
547   - settings[:analysis][:analyzer][default_analyzer][:filter].insert(4, "searchkick_wordnet")
548   - settings[:analysis][:analyzer][default_analyzer][:filter] << "searchkick_wordnet"
549   -
550   - %w(word_start word_middle word_end).each do |type|
551   - settings[:analysis][:analyzer]["searchkick_#{type}_index".to_sym][:filter].insert(2, "searchkick_wordnet")
552   - end
553   - end
554   -
555 538 def set_deep_paging(settings)
556 539 if !settings.dig(:index, :max_result_window) && !settings[:"index.max_result_window"]
557 540 settings[:index] ||= {}
... ...
lib/searchkick/model.rb
... ... @@ -7,7 +7,7 @@ module Searchkick
7 7 :filterable, :geo_shape, :highlight, :ignore_above, :index_name, :index_prefix, :inheritance, :language,
8 8 :locations, :mappings, :match, :merge_mappings, :routing, :searchable, :search_synonyms, :settings, :similarity,
9 9 :special_characters, :stem, :stemmer, :stem_conversions, :stem_exclusion, :stemmer_override, :suggest, :synonyms, :text_end,
10   - :text_middle, :text_start, :word, :wordnet, :word_end, :word_middle, :word_start]
  10 + :text_middle, :text_start, :word, :word_end, :word_middle, :word_start]
11 11 raise ArgumentError, "unknown keywords: #{unknown_keywords.join(", ")}" if unknown_keywords.any?
12 12  
13 13 raise "Only call searchkick once per model" if respond_to?(:searchkick_index)
... ...
test/models/animal.rb
... ... @@ -4,6 +4,5 @@ class Animal
4 4 text_start: [:name],
5 5 suggest: [:name],
6 6 index_name: -> { "#{name.tableize}-#{Date.today.year}#{Searchkick.index_suffix}" },
7   - callbacks: :async,
8   - wordnet: ENV["WORDNET"]
  7 + callbacks: :async
9 8 end
... ...
test/synonyms_test.rb
... ... @@ -31,14 +31,6 @@ class SynonymsTest &lt; Minitest::Test
31 31 assert_search "clorox", ["Clorox Bleach", "Kroger Bleach"], fields: [{name: :word_start}]
32 32 end
33 33  
34   - def test_wordnet
35   - # requires WordNet
36   - skip unless ENV["WORDNET"]
37   -
38   - store_names ["Creature", "Beast", "Dragon"], Animal
39   - assert_search "animal", ["Creature", "Beast"], {}, Animal
40   - end
41   -
42 34 def test_directional
43 35 store_names ["Lightbulb", "Green Onions", "Led"]
44 36 assert_search "led", ["Lightbulb", "Led"]
... ...
test/test_helper.rb
... ... @@ -25,9 +25,6 @@ end
25 25 Searchkick.search_timeout = 5
26 26 Searchkick.index_suffix = ENV["TEST_ENV_NUMBER"] # for parallel tests
27 27  
28   -# add to elasticsearch-7.0.0/config/
29   -Searchkick.wordnet_path = "wn_s.pl" if ENV["WORDNET"]
30   -
31 28 puts "Running against #{Searchkick.opensearch? ? "OpenSearch" : "Elasticsearch"} #{Searchkick.server_version}"
32 29  
33 30 Searchkick.redis =
... ...