Class: Chewy::Search::Parameters::Indices
- Defined in:
- lib/chewy/search/parameters/indices.rb
Overview
Stores indices to query. Renders it to lists of string accepted by ElasticSearch API.
If index is added to the storage, no matter, a class or a string/symbol, it gets appended to the list.
Instance Attribute Summary
Attributes inherited from Storage
Instance Method Summary collapse
- 
  
    
      #==(other)  ⇒ true, false 
    
    
  
  
  
  
  
  
  
  
  
    Two index storages are equal if they produce the same output on render. 
- 
  
    
      #indices  ⇒ Array<Chewy::Index> 
    
    
  
  
  
  
  
  
  
  
  
    Returns index classes used for the request. 
- 
  
    
      #render  ⇒ {Symbol => Array<String>} 
    
    
  
  
  
  
  
  
  
  
  
    Returns desired index names. 
- 
  
    
      #update!(other_value)  ⇒ {Symbol => Array<Chewy::Index, String, Symbol>} 
    
    
  
  
  
  
  
  
  
  
  
    Just adds indices to indices. 
Methods inherited from Storage
#initialize, #merge!, #replace!
Constructor Details
This class inherits a constructor from Chewy::Search::Parameters::Storage
Instance Method Details
#==(other) ⇒ true, false
Two index storages are equal if they produce the same output on render.
| 19 20 21 | # File 'lib/chewy/search/parameters/indices.rb', line 19 def ==(other) super || (other.class == self.class && other.render == render) end | 
#indices ⇒ Array<Chewy::Index>
Returns index classes used for the request. No strings/symbols included.
| 46 47 48 | # File 'lib/chewy/search/parameters/indices.rb', line 46 def indices index_classes end | 
#render ⇒ {Symbol => Array<String>}
Returns desired index names.
| 38 39 40 | # File 'lib/chewy/search/parameters/indices.rb', line 38 def render {index: index_names.uniq.sort}.reject { |_, v| v.blank? } end | 
#update!(other_value) ⇒ {Symbol => Array<Chewy::Index, String, Symbol>}
Just adds indices to indices.
| 28 29 30 31 32 | # File 'lib/chewy/search/parameters/indices.rb', line 28 def update!(other_value) new_value = normalize(other_value) @value = {indices: value[:indices] | new_value[:indices]} end |