Class: Eson::Search::Indices
- Inherits:
-
Object
- Object
- Eson::Search::Indices
- Includes:
- Query
- Defined in:
- lib/eson/search/indices.rb
Instance Attribute Summary collapse
-
#indices { ... } ⇒ self
Generates a ‘indices` query in a query context.
-
#no_match_val ⇒ Object
Returns the value of attribute no_match_val.
-
#query_val ⇒ Object
Returns the value of attribute query_val.
Instance Method Summary collapse
-
#initialize(*indices) ⇒ Indices
constructor
A new instance of Indices.
- #no_match_query(no_match_val = nil) ⇒ Object
- #query(&block) ⇒ Object
- #to_query_hash ⇒ Object
Methods included from Query
Constructor Details
#initialize(*indices) ⇒ Indices
Returns a new instance of Indices.
11 12 13 |
# File 'lib/eson/search/indices.rb', line 11 def initialize(*indices) self.indices = indices end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Eson::Search::Query
Instance Attribute Details
#indices { ... } ⇒ self
7 |
# File 'lib/eson/search/indices.rb', line 7 short_name :indices |
#no_match_val ⇒ Object
Returns the value of attribute no_match_val.
9 10 11 |
# File 'lib/eson/search/indices.rb', line 9 def no_match_val @no_match_val end |
#query_val ⇒ Object
Returns the value of attribute query_val.
9 10 11 |
# File 'lib/eson/search/indices.rb', line 9 def query_val @query_val end |
Instance Method Details
#no_match_query(no_match_val = nil) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/eson/search/indices.rb', line 20 def no_match_query(no_match_val = nil) if no_match_val self.no_match_val = no_match_val elsif block_given? self.no_match_val ||= SubQuery.new(args) self.no_match_val.send(context, &Proc.new) end end |
#query(&block) ⇒ Object
15 16 17 18 |
# File 'lib/eson/search/indices.rb', line 15 def query(&block) self.query_val ||= SubQuery.new(args) self.query_val.send(context, &Proc.new) end |
#to_query_hash ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/eson/search/indices.rb', line 29 def to_query_hash = { :indices => indices, :query => self.query_val.to_query_hash, } if no_match_val if no_match_val.respond_to? :to_query_hash no_match = no_match_val.to_query_hash else no_match = no_match_val end .merge!(:no_match_query => no_match) end { name => } end |