module RediSearch::Search::Clauses
Public Instance Methods
and(new_term = nil, **term_options)
click to toggle source
# File lib/redi_search/search/clauses.rb, line 86 def and(new_term = nil, **term_options) @term_clause = And.new(self, new_term, @term_clause, **term_options) if new_term.nil? @term_clause else self end end
count()
click to toggle source
# File lib/redi_search/search/clauses.rb, line 68 def count return to_a.size if loaded? RediSearch.client.call!( "SEARCH", index.name, term_clause.to_s, *Limit.new(total: 0).clause ).first end
highlight(fields: [], opening_tag: "<b>", closing_tag: "</b>")
click to toggle source
# File lib/redi_search/search/clauses.rb, line 22 def highlight(fields: [], opening_tag: "<b>", closing_tag: "</b>") add_to_clause(Highlight.new( fields: fields, opening_tag: opening_tag, closing_tag: closing_tag )) end
in_order()
click to toggle source
# File lib/redi_search/search/clauses.rb, line 32 def in_order add_to_clause(InOrder.new) end
language(language)
click to toggle source
# File lib/redi_search/search/clauses.rb, line 56 def language(language) add_to_clause(Language.new(language: language)) end
limit(total, offset = 0)
click to toggle source
# File lib/redi_search/search/clauses.rb, line 64 def limit(total, offset = 0) add_to_clause(Limit.new(total: total, offset: offset)) end
no_content()
click to toggle source
# File lib/redi_search/search/clauses.rb, line 48 def no_content add_to_clause(NoContent.new) end
no_stop_words()
click to toggle source
# File lib/redi_search/search/clauses.rb, line 40 def no_stop_words add_to_clause(NoStopWords.new) end
or(new_term = nil, **term_options)
click to toggle source
# File lib/redi_search/search/clauses.rb, line 96 def or(new_term = nil, **term_options) @term_clause = Or.new(self, new_term, @term_clause, **term_options) if new_term.nil? @term_clause else self end end
return(*fields)
click to toggle source
# File lib/redi_search/search/clauses.rb, line 52 def return(*fields) add_to_clause(Return.new(fields: fields)) end
slop(slop)
click to toggle source
# File lib/redi_search/search/clauses.rb, line 28 def slop(slop) add_to_clause(Slop.new(slop: slop)) end
sort_by(field, order: :asc)
click to toggle source
# File lib/redi_search/search/clauses.rb, line 60 def sort_by(field, order: :asc) add_to_clause(SortBy.new(field: field, order: order)) end
verbatim()
click to toggle source
# File lib/redi_search/search/clauses.rb, line 36 def verbatim add_to_clause(Verbatim.new) end
where(**condition)
click to toggle source
# File lib/redi_search/search/clauses.rb, line 76 def where(**condition) @term_clause = Where.new(self, condition, @term_clause) if condition.empty? @term_clause else self end end
with_scores()
click to toggle source
# File lib/redi_search/search/clauses.rb, line 44 def with_scores add_to_clause(WithScores.new) end
Private Instance Methods
add_to_clause(clause)
click to toggle source
# File lib/redi_search/search/clauses.rb, line 108 def add_to_clause(clause) clauses.push(*clause.clause) if used_clauses.add?(clause.class) self end