Commit c04b49114da0e0f95618cc3a722b7ba10524cff3

Authored by Andrew Kane
1 parent e7f46999

Updated ngram filter names

Showing 1 changed file with 5 additions and 2 deletions   Show diff stats
lib/searchkick/index_options.rb
@@ -13,6 +13,9 @@ module Searchkick @@ -13,6 +13,9 @@ module Searchkick
13 index_type = index_type.call if index_type.respond_to?(:call) 13 index_type = index_type.call if index_type.respond_to?(:call)
14 end 14 end
15 15
  16 + ngram_type = below70 ? "nGram" : "ngram"
  17 + edge_ngram_type = below70 ? "edgeNGram" : "edge_ngram"
  18 +
16 custom_mapping = options[:mappings] || {} 19 custom_mapping = options[:mappings] || {}
17 if below70 && custom_mapping.keys.map(&:to_sym).include?(:properties) 20 if below70 && custom_mapping.keys.map(&:to_sym).include?(:properties)
18 # add type 21 # add type
@@ -126,12 +129,12 @@ module Searchkick @@ -126,12 +129,12 @@ module Searchkick
126 max_shingle_size: 5 129 max_shingle_size: 5
127 }, 130 },
128 searchkick_edge_ngram: { 131 searchkick_edge_ngram: {
129 - type: "edgeNGram", 132 + type: edge_ngram_type,
130 min_gram: 1, 133 min_gram: 1,
131 max_gram: 50 134 max_gram: 50
132 }, 135 },
133 searchkick_ngram: { 136 searchkick_ngram: {
134 - type: "nGram", 137 + type: ngram_type,
135 min_gram: 1, 138 min_gram: 1,
136 max_gram: 50 139 max_gram: 50
137 }, 140 },