Class: AgnosticBackend::Queryable::Query

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

Direct Known Subclasses

Cloudsearch::Query, Elasticsearch::Query

Instance Attribute Summary collapse

Attributes inherited from TreeNode

#children

Instance Method Summary collapse

Methods inherited from TreeNode

#==, #accept

Methods included from Utilities

included

Constructor Details

#initialize(context, **options) ⇒ Query

Returns a new instance of Query.



9
10
11
12
13
14
# File 'lib/agnostic_backend/queryable/query.rb', line 9

def initialize(context, **options)
  super()
  @errors ||= Hash.new { |hash, key| hash[key] = Array.new }
  @context = context
  @options = options
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



5
6
7
# File 'lib/agnostic_backend/queryable/query.rb', line 5

def context
  @context
end

#errorsObject

Returns the value of attribute errors.



4
5
6
# File 'lib/agnostic_backend/queryable/query.rb', line 4

def errors
  @errors
end

#executorObject (readonly)

Returns the value of attribute executor.



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

def executor
  @executor
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#executeObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/agnostic_backend/queryable/query.rb', line 16

def execute
  raise NotImplementedError
end

#set_scroll_cursor(value) ⇒ Object



24
25
26
27
# File 'lib/agnostic_backend/queryable/query.rb', line 24

def set_scroll_cursor(value)
  context.scroll_cursor(value)
  context.build
end

#valid?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/agnostic_backend/queryable/query.rb', line 20

def valid?
  self.accept(AgnosticBackend::Queryable::Validator.new)
end