Class: AgnosticBackend::Queryable::Elasticsearch::Query

Inherits:
Query
  • Object
show all
Defined in:
lib/agnostic_backend/queryable/elasticsearch/query.rb

Instance Attribute Summary

Attributes inherited from Query

#context, #errors, #executor, #options

Attributes inherited from TreeNode

#children, #context

Instance Method Summary collapse

Methods inherited from Query

#set_scroll_cursor, #valid?

Methods inherited from TreeNode

#==, #accept

Methods included from Utilities

included

Constructor Details

#initialize(base, **options) ⇒ Query

Returns a new instance of Query.



6
7
8
9
# File 'lib/agnostic_backend/queryable/elasticsearch/query.rb', line 6

def initialize(base, **options)
  super
  @executor = Executor.new(self, Visitor.new)
end

Instance Method Details

#executeObject



11
12
13
# File 'lib/agnostic_backend/queryable/elasticsearch/query.rb', line 11

def execute
  @executor.execute if valid?
end

#execute!Object



15
16
17
18
19
20
21
# File 'lib/agnostic_backend/queryable/elasticsearch/query.rb', line 15

def execute!
  if valid?
    @executor.execute
  else
    raise StandardError, errors
  end
end

#to_sObject



23
24
25
# File 'lib/agnostic_backend/queryable/elasticsearch/query.rb', line 23

def to_s
  @executor.to_s
end