Class: Arelastic::Builders::Queries

Inherits:
Struct
  • Object
show all
Defined in:
lib/arelastic/builders/queries.rb

Constant Summary collapse

MACROS_TO_ARELASTIC =
{
  bool:                Arelastic::Queries::Bool,
  constant_score:      Arelastic::Queries::ConstantScore,
  dis_max:             Arelastic::Queries::DisMax,
  exists:              Arelastic::Queries::Exists,
  field:               Arelastic::Queries::Field,
  filter:              Arelastic::Queries::Filter,
  function_score:      Arelastic::Queries::FunctionScore,
  fuzzy:               Arelastic::Queries::Fuzzy,
  geo_bounding_box:    Arelastic::Queries::GeoBoundingBox,
  geo_distance:        Arelastic::Queries::GeoDistance,
  geo_polygon:         Arelastic::Queries::GeoPolygon,
  has_child:           Arelastic::Queries::HasChild,
  ids:                 Arelastic::Queries::Ids,
  limit:               Arelastic::Queries::Limit,
  match:               Arelastic::Queries::Match,
  match_all:           Arelastic::Queries::MatchAll,
  match_none:          Arelastic::Queries::MatchNone,
  match_phrase:        Arelastic::Queries::MatchPhrase,
  multi_match:         Arelastic::Queries::MultiMatch,
  nested:              Arelastic::Queries::Nested,
  percolate:           Arelastic::Queries::Percolate,
  prefix:              Arelastic::Queries::Prefix,
  query:               Arelastic::Queries::Query,
  query_string:        Arelastic::Queries::QueryString,
  range:               Arelastic::Queries::Range,
  regexp:              Arelastic::Queries::Regexp,
  script:              Arelastic::Queries::Script,
  simple_query_string: Arelastic::Queries::SimpleQueryString,
  term:                Arelastic::Queries::Term,
  terms:               Arelastic::Queries::Terms,
  wildcard:            Arelastic::Queries::Wildcard
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



3
4
5
# File 'lib/arelastic/builders/queries.rb', line 3

def name
  @name
end

Class Method Details

.[](field) ⇒ Object



39
40
41
# File 'lib/arelastic/builders/queries.rb', line 39

def [](field)
  new(field)
end

Instance Method Details

#gt(other) ⇒ Object



77
78
79
# File 'lib/arelastic/builders/queries.rb', line 77

def gt other
  range 'gt' => other
end

#gte(other) ⇒ Object



73
74
75
# File 'lib/arelastic/builders/queries.rb', line 73

def gte other
  range 'gte' => other
end

#in(other, options = {}) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/arelastic/builders/queries.rb', line 56

def in other, options = {}
  case other
  when Range
    if other.exclude_end?
      range 'gte' => other.begin, 'lt' => other.end
    else
      range 'gte' => other.begin, 'lte' => other.end
    end
  else
    terms other, options
  end
end

#lt(other) ⇒ Object



85
86
87
# File 'lib/arelastic/builders/queries.rb', line 85

def lt other
  range 'lt' => other
end

#lte(other) ⇒ Object



81
82
83
# File 'lib/arelastic/builders/queries.rb', line 81

def lte other
  range 'lte' => other
end

#missing(options = {}) ⇒ Object



69
70
71
# File 'lib/arelastic/builders/queries.rb', line 69

def missing(options = {})
  exists(options).negate
end