Method: Riddle::Query.snippets

Defined in:
lib/riddle/query.rb

.snippets(data, index, query, options = nil) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/riddle/query.rb', line 67

def self.snippets(data, index, query, options = nil)
  data, index, query = quote(data), quote(index), quote(query)

  options = ', ' + options.keys.collect { |key|
    value = translate_value options[key]
    value = quote value if value.is_a?(String)

    "#{value} AS #{key}"
  }.join(', ') unless options.nil?

  "CALL SNIPPETS(#{data}, #{index}, #{query}#{options})"
end