Module: Eson::Search::QueryGroup

Includes:
Filters, Parametrized, Queries
Included in:
BaseQuery, HasChild, Nested, SubQuery, TopChildren
Defined in:
lib/eson/search/query_group.rb

Instance Attribute Summary

Attributes included from Parametrized

#args

Attributes included from Queries

#queries

Attributes included from Filters

#filters

Instance Method Summary collapse

Methods included from Parametrized

#initialize, #param

Methods included from Queries

#queries?, register

Methods included from Filters

#filters?, register

Instance Method Details

#to_hashObject



29
30
31
# File 'lib/eson/search/query_group.rb', line 29

def to_hash
  to_query_hash
end

#to_query_hashObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/eson/search/query_group.rb', line 8

def to_query_hash
  if queries && filters && queries.any? && filters.any?
    hash = {
      :filtered => {
        :query => queries.to_query_hash,
        :filter => filters.to_query_hash
      }
    }
  else
    if filters && filters.any?
      hash = filters.to_query_hash
    end

    if queries && queries.any?
      hash = queries.to_query_hash
    end
  end

  hash
end