Class: ElasticsearchQuery::Query
- Inherits:
-
Object
- Object
- ElasticsearchQuery::Query
- Defined in:
- lib/elasticsearch_query/query.rb
Class Attribute Summary collapse
-
.paginator_class ⇒ Object
Returns the value of attribute paginator_class.
Instance Method Summary collapse
- #filters ⇒ Object
-
#initialize(params) ⇒ Query
constructor
A new instance of Query.
- #paginator ⇒ Object
- #sort ⇒ Object
- #to_count_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(params) ⇒ Query
Returns a new instance of Query.
3 4 5 6 7 8 9 |
# File 'lib/elasticsearch_query/query.rb', line 3 def initialize( params ) if params.respond_to? :with_indifferent_access @params = params.with_indifferent_access else @params = params end end |
Class Attribute Details
.paginator_class ⇒ Object
Returns the value of attribute paginator_class.
42 43 44 |
# File 'lib/elasticsearch_query/query.rb', line 42 def paginator_class @paginator_class end |
Instance Method Details
#filters ⇒ Object
15 16 17 |
# File 'lib/elasticsearch_query/query.rb', line 15 def filters @_filters ||= Filters.new @params end |
#paginator ⇒ Object
19 20 21 |
# File 'lib/elasticsearch_query/query.rb', line 19 def paginator @_paginator ||= self.class.paginator_class.new @params end |
#sort ⇒ Object
11 12 13 |
# File 'lib/elasticsearch_query/query.rb', line 11 def sort @_sort ||= Sort.new @params end |
#to_count_hash ⇒ Object
31 32 33 |
# File 'lib/elasticsearch_query/query.rb', line 31 def to_count_hash base_query end |
#to_hash ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/elasticsearch_query/query.rb', line 23 def to_hash @hash ||= begin base_query .merge sort.to_hash .merge paginator.to_hash end end |