Class: Eson::Search::Nested

Inherits:
Object
  • Object
show all
Includes:
Query, QueryGroup
Defined in:
lib/eson/search/nested.rb

Instance Attribute Summary collapse

Attributes included from Parametrized

#args

Attributes included from Queries

#queries

Attributes included from Filters

#filters

Instance Method Summary collapse

Methods included from QueryGroup

#to_hash

Methods included from Parametrized

#param

Methods included from Queries

#queries?, register

Methods included from Filters

#filters?, register

Methods included from Query

included, #method_missing

Constructor Details

#initialize(options = {}) ⇒ Nested

Returns a new instance of Nested.



12
13
14
15
# File 'lib/eson/search/nested.rb', line 12

def initialize(options = {})
  self.options = options
  instance_exec(self, &Proc.new) if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Eson::Search::Query

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



10
11
12
# File 'lib/eson/search/nested.rb', line 10

def options
  @options
end

Instance Method Details

#nested { ... } ⇒ self

Generates a ‘nested` query in a query context.

Yields:

  • the block containing further options and subqueries

Returns:

  • (self)

    the generated facet



8
# File 'lib/eson/search/nested.rb', line 8

short_name :nested

#to_query_hashObject



17
18
19
20
21
# File 'lib/eson/search/nested.rb', line 17

def to_query_hash
  {
    name => {:query => super}.merge(options)
  }
end