Class: AgnosticBackend::Queryable::Cloudsearch::Executor

Inherits:
Executor
  • Object
show all
Includes:
Utilities
Defined in:
lib/agnostic_backend/queryable/cloudsearch/executor.rb

Instance Attribute Summary

Attributes inherited from Executor

#options, #query, #visitor

Instance Method Summary collapse

Methods included from Utilities

included

Methods inherited from Executor

#initialize

Constructor Details

This class inherits a constructor from AgnosticBackend::Queryable::Executor

Instance Method Details

#executeObject



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

def execute
  with_exponential_backoff Aws::CloudSearch::Errors::Throttling do
    response = client.search(params)
    ResultSet.new(response, query)
  end
end

#paramsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/agnostic_backend/queryable/cloudsearch/executor.rb', line 29

def params
  {
    cursor: scroll_cursor,
    expr: expr,
    facet: facet,
    filter_query: filter_query,
    highlight: highlight,
    partial: partial,
    query: query_expression,
    query_options: query_options,
    query_parser: query_parser,
    return: return_expression,
    size: size,
    sort: sort,
    start: start
  }
end

#to_sObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/agnostic_backend/queryable/cloudsearch/executor.rb', line 16

def to_s
  result = ''
  result += "search?q=#{query_expression}" if query_expression
  result += " filter=#{filter_query}" if filter_query
  result += " return=#{return_expression}" if return_expression
  result += " sort=#{sort}" if sort
  result += " size=#{size}" if size
  result += " offset=#{start}" if start
  result += " cursor=#{scroll_cursor}" if scroll_cursor
  result += " parser=#{query_parser}"
  result
end