Module: RediSearch::Search::Queries

Included in:
Aggregate, RediSearch::Search
Defined in:
lib/redi_search/search/queries.rb,
lib/redi_search/search/queries/or.rb,
lib/redi_search/search/queries/and.rb,
lib/redi_search/search/queries/where.rb,
lib/redi_search/search/queries/boolean.rb

Defined Under Namespace

Classes: And, Boolean, Or, Where

Instance Method Summary collapse

Instance Method Details

#and(new_term = nil, **term_options) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/redi_search/search/queries.rb', line 18

def and(new_term = nil, **term_options)
  @query = Queries::And.new(self, new_term, @query, **term_options)

  if new_term.nil?
    @query
  else
    self
  end
end

#not(**condition) ⇒ Object

Raises:

  • (NoMethodError)


12
13
14
15
16
# File 'lib/redi_search/search/queries.rb', line 12

def not(**condition)
  raise NoMethodError unless @query.is_a?(Search::Queries::Where)

  @query.not(condition)
end

#or(new_term = nil, **term_options) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/redi_search/search/queries.rb', line 28

def or(new_term = nil, **term_options)
  @query = Queries::Or.new(self, new_term, @query, **term_options)

  if new_term.nil?
    @query
  else
    self
  end
end

#where(**condition) ⇒ Object



6
7
8
9
10
# File 'lib/redi_search/search/queries.rb', line 6

def where(**condition)
  @query = Search::Queries::Where.new(self, condition, @query)

  self
end