class ElasticsearchQueryParser::Grammar::Presenters::Operator

Attributes

operator[R]

Public Class Methods

new(operator) click to toggle source
# File lib/elasticsearch_query_parser/grammar/presenters/operator.rb, line 22
def initialize(operator)
  @operator = (operator || "OR").to_s.downcase
end

Public Instance Methods

to_elasticsearch() click to toggle source
# File lib/elasticsearch_query_parser/grammar/presenters/operator.rb, line 26
def to_elasticsearch
  case operator
  when "and"
    :must
  when "not"
    :must_not
  when "or"
    :should
  else
    raise InvalidOperatorString, operator
  end
end