Class: Eson::Search::HasChild

Inherits:
Object
  • Object
show all
Includes:
Filter, Query, QueryGroup
Defined in:
lib/eson/search/has_child.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 Filter

included, #method_missing

Methods included from Query

included, #method_missing

Constructor Details

#initialize(type, options = {}) ⇒ HasChild

Returns a new instance of HasChild.



15
16
17
# File 'lib/eson/search/has_child.rb', line 15

def initialize(type, options = {})
  self.options = options.merge(:type => type)
end

Dynamic Method Handling

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

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#has_child { ... } ⇒ self #has_child { ... } ⇒ self

Overloads:

  • #has_child { ... } ⇒ self

    Generates a ‘has_child` filter in a filter context.

    Yields:

    • the block containing further options and subfilters

    Returns:

    • (self)

      the generated facet

  • #has_child { ... } ⇒ self

    Generates a ‘has_child` facet in a facets context.

    Yields:

    • the block describing further options

    Returns:

    • (self)

      the generated facet



11
# File 'lib/eson/search/has_child.rb', line 11

short_name :has_child

#to_query_hashObject



19
20
21
22
23
# File 'lib/eson/search/has_child.rb', line 19

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