Module: RediSearch::Model::ClassMethods

Defined in:
lib/redi_search/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#search_indexObject (readonly)

Returns the value of attribute search_index.



10
11
12
# File 'lib/redi_search/model.rb', line 10

def search_index
  @search_index
end

Instance Method Details

#redi_search(**options, &schema) ⇒ Object

rubocop:disable Metrics/MethodLength



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/redi_search/model.rb', line 13

def redi_search(**options, &schema)
  @search_index = Index.new(
    [options[:index_prefix], model_name.plural, RediSearch.env].
      compact.join("_"),
    self, &schema
  )
  register_search_commit_hooks

  scope :search_import, -> { all } unless defined?(search_import)

  include InstanceMethods
  extend ModelClassMethods
end