Class: Chewy::Index::Settings
- Inherits:
-
Object
- Object
- Chewy::Index::Settings
- Defined in:
- lib/chewy/index/settings.rb
Overview
Stores ElasticSearch index settings and resolves analysis
hash. At first, you need to store some analyzers or other
analysis options to the corresponding repository:
title_nysiis
filter here will be expanded automatically when
title_analyzer
analyser will be used in index settings:
Additional analysing options, which wasn't stored in repositories, might be used as well.
Instance Method Summary collapse
-
#initialize(params = {}, &block) ⇒ Settings
constructor
A new instance of Settings.
- #to_hash ⇒ Object
Constructor Details
#initialize(params = {}, &block) ⇒ Settings
Returns a new instance of Settings.
28 29 30 31 |
# File 'lib/chewy/index/settings.rb', line 28 def initialize(params = {}, &block) @params = params @proc_params = block end |
Instance Method Details
#to_hash ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/chewy/index/settings.rb', line 33 def to_hash settings = @params.deep_symbolize_keys settings.merge!((@proc_params.call || {}).deep_symbolize_keys) if @proc_params settings[:analysis] = resolve_analysis(settings[:analysis]) if settings[:analysis] if settings[:index] || Chewy.configuration[:index] settings[:index] = (Chewy.configuration[:index] || {}) .deep_merge((settings[:index] || {}).deep_symbolize_keys) end settings.present? ? {settings: settings} : {} end |