Module: Sequel::Plugins::Elasticsearch
- Defined in:
- lib/sequel/plugins/elasticsearch.rb,
lib/sequel/plugins/elasticsearch/result.rb
Overview
The Sequel::Elasticsearch model plugin
Defined Under Namespace
Modules: ClassMethods, InstanceMethods Classes: Result
Class Method Summary collapse
-
.apply(model, _opts = OPTS) ⇒ Object
Apply the plugin to the specified model.
-
.configure(model, opts = OPTS) ⇒ Object
Configure the plugin.
Class Method Details
.apply(model, _opts = OPTS) ⇒ Object
Apply the plugin to the specified model
18 19 20 |
# File 'lib/sequel/plugins/elasticsearch.rb', line 18 def self.apply(model, _opts = OPTS) model end |
.configure(model, opts = OPTS) ⇒ Object
Configure the plugin
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sequel/plugins/elasticsearch.rb', line 23 def self.configure(model, opts = OPTS) environment_scoped = if opts[:environment_scoped].nil? model.environment != 'test' else opts[:environment_scoped] end model.elasticsearch_opts = opts[:elasticsearch] || {} model.elasticsearch_index = (opts[:index] || model.table_name).to_sym model.elasticsearch_type = (opts[:type] || :_doc).to_sym model.elasticsearch_environment_scoped = environment_scoped model end |