Class: RediSearch::Search::Clauses::Highlight

Inherits:
ApplicationClause show all
Defined in:
lib/redi_search/search/clauses/highlight.rb

Instance Method Summary collapse

Methods inherited from ApplicationClause

#clause_order, clause_order, clause_term

Methods included from Validatable

included, #validate!

Constructor Details

#initialize(fields: [], opening_tag: "<b>", closing_tag: "</b>") ⇒ Highlight

Returns a new instance of Highlight.



9
10
11
12
13
# File 'lib/redi_search/search/clauses/highlight.rb', line 9

def initialize(fields: [], opening_tag: "<b>", closing_tag: "</b>")
  @fields = fields
  @opening_tag = opening_tag
  @closing_tag = closing_tag
end

Instance Method Details

#clauseObject



15
16
17
18
19
20
21
# File 'lib/redi_search/search/clauses/highlight.rb', line 15

def clause
  [
    "HIGHLIGHT",
    fields_clause,
    tags_clause,
  ].compact.flatten(1)
end