Module: Estella::Searchable::ClassMethods
- Defined in:
- lib/estella/searchable.rb
Instance Method Summary collapse
- #default_analysis_fields ⇒ Object
-
#index_slug ⇒ Object
support for mongoid::slug indexes slug attribute by default.
-
#searchable(settings = Estella::Analysis::DEFAULT_SETTINGS, &block) ⇒ Object
sets up mappings and settings for index.
Instance Method Details
#default_analysis_fields ⇒ Object
69 70 71 |
# File 'lib/estella/searchable.rb', line 69 def default_analysis_fields Estella::Analysis::DEFAULT_FIELDS end |
#index_slug ⇒ Object
support for mongoid::slug indexes slug attribute by default
62 63 64 65 66 67 |
# File 'lib/estella/searchable.rb', line 62 def index_slug if defined? slug indexed_fields.merge!(slug: { type: :keyword }) indexed_json.merge!(slug: :slug) end end |
#searchable(settings = Estella::Analysis::DEFAULT_SETTINGS, &block) ⇒ Object
sets up mappings and settings for index
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/estella/searchable.rb', line 74 def searchable(settings = Estella::Analysis::DEFAULT_SETTINGS, &block) Estella::Parser.new(self).instance_eval(&block) index_slug indexed_fields = @indexed_fields settings(settings) do mapping do indexed_fields.each do |name, opts| indexes name, opts.except(:analysis, :using, :factor, :filter, :include_raw) end end end end |