Commit c2922b9f14d19b3e29b2e8f0d0fe8cfeccc20336
1 parent
a6870254
Exists in
master
and in
19 other branches
Fixed linter errors [skip ci]
Showing
3 changed files
with
9 additions
and
9 deletions
Show diff stats
lib/searchkick/index_options.rb
... | ... | @@ -4,8 +4,8 @@ module Searchkick |
4 | 4 | options = @options |
5 | 5 | language = options[:language] |
6 | 6 | language = language.call if language.respond_to?(:call) |
7 | - type = options[:_type] | |
8 | - type = type.call if type.respond_to?(:call) | |
7 | + index_type = options[:_type] | |
8 | + index_type = index_type.call if index_type.respond_to?(:call) | |
9 | 9 | |
10 | 10 | if options[:mappings] && !options[:merge_mappings] |
11 | 11 | settings = options[:settings] || {} |
... | ... | @@ -163,7 +163,7 @@ module Searchkick |
163 | 163 | settings[:analysis][:filter][:searchkick_synonym] = { |
164 | 164 | type: "synonym", |
165 | 165 | # only remove a single space from synonyms so three-word synonyms will fail noisily instead of silently |
166 | - synonyms: synonyms.select { |s| s.size > 1 }.map { |s| s.is_a?(Array) ? s.map { |s| s.sub(/\s+/, "") }.join(",") : s }.map(&:downcase) | |
166 | + synonyms: synonyms.select { |s| s.size > 1 }.map { |s| s.is_a?(Array) ? s.map { |s2| s2.sub(/\s+/, "") }.join(",") : s }.map(&:downcase) | |
167 | 167 | } |
168 | 168 | # choosing a place for the synonym filter when stemming is not easy |
169 | 169 | # https://groups.google.com/forum/#!topic/elasticsearch/p7qcQlgHdB8 |
... | ... | @@ -308,7 +308,7 @@ module Searchkick |
308 | 308 | multi_field = dynamic_fields["{name}"].merge(fields: dynamic_fields.except("{name}")) |
309 | 309 | |
310 | 310 | mappings = { |
311 | - type => { | |
311 | + index_type => { | |
312 | 312 | properties: mapping, |
313 | 313 | _routing: routing, |
314 | 314 | # https://gist.github.com/kimchy/2898285 | ... | ... |
lib/searchkick/query.rb
... | ... | @@ -135,7 +135,7 @@ module Searchkick |
135 | 135 | if searchkick_index |
136 | 136 | puts "Model Search Data" |
137 | 137 | begin |
138 | - pp klass.first(3).map { |r| {index: searchkick_index.record_data(r).merge(data: searchkick_index.send(:search_data, r))}} | |
138 | + pp(klass.first(3).map { |r| {index: searchkick_index.record_data(r).merge(data: searchkick_index.send(:search_data, r))}}) | |
139 | 139 | rescue => e |
140 | 140 | puts "#{e.class.name}: #{e.message}" |
141 | 141 | end |
... | ... | @@ -331,7 +331,7 @@ module Searchkick |
331 | 331 | end |
332 | 332 | |
333 | 333 | if misspellings != false && match_type == :match |
334 | - qs.concat qs.map { |q| q.except(:cutoff_frequency).merge(fuzziness: edit_distance, prefix_length: prefix_length, max_expansions: max_expansions, boost: factor).merge(transpositions) } | |
334 | + qs.concat(qs.map { |q| q.except(:cutoff_frequency).merge(fuzziness: edit_distance, prefix_length: prefix_length, max_expansions: max_expansions, boost: factor).merge(transpositions) }) | |
335 | 335 | end |
336 | 336 | |
337 | 337 | if field.start_with?("*.") |
... | ... | @@ -706,7 +706,7 @@ module Searchkick |
706 | 706 | ranges: agg_options[:date_ranges] |
707 | 707 | }.merge(shared_agg_options) |
708 | 708 | } |
709 | - elsif histogram = agg_options[:date_histogram] | |
709 | + elsif (histogram = agg_options[:date_histogram]) | |
710 | 710 | interval = histogram[:interval] |
711 | 711 | payload[:aggs][field] = { |
712 | 712 | date_histogram: { |
... | ... | @@ -714,7 +714,7 @@ module Searchkick |
714 | 714 | interval: interval |
715 | 715 | } |
716 | 716 | } |
717 | - elsif metric = @@metric_aggs.find { |k| agg_options.has_key?(k) } | |
717 | + elsif (metric = @@metric_aggs.find { |k| agg_options.has_key?(k) }) | |
718 | 718 | payload[:aggs][field] = { |
719 | 719 | metric => { |
720 | 720 | field: agg_options[metric][:field] || field | ... | ... |
lib/searchkick/reindex_queue.rb
... | ... | @@ -15,7 +15,7 @@ module Searchkick |
15 | 15 | # TODO use reliable queuing |
16 | 16 | def reserve(limit: 1000) |
17 | 17 | record_ids = Set.new |
18 | - while record_ids.size < limit && record_id = Searchkick.with_redis { |r| r.rpop(redis_key) } | |
18 | + while record_ids.size < limit && (record_id = Searchkick.with_redis { |r| r.rpop(redis_key) }) | |
19 | 19 | record_ids << record_id |
20 | 20 | end |
21 | 21 | record_ids.to_a | ... | ... |