class RediSearch::Search::Clauses::Highlight
Attributes
closing_tag[R]
fields[R]
opening_tag[R]
Public Class Methods
new(fields: [], opening_tag: "<b>", closing_tag: "</b>")
click to toggle source
# File lib/redi_search/search/clauses/highlight.rb, line 7 def initialize(fields: [], opening_tag: "<b>", closing_tag: "</b>") @fields = fields @opening_tag = opening_tag @closing_tag = closing_tag end
Public Instance Methods
clause()
click to toggle source
# File lib/redi_search/search/clauses/highlight.rb, line 13 def clause [ "HIGHLIGHT", fields_clause, tags_clause, ].compact.flatten(1) end
Private Instance Methods
arg_error(msg)
click to toggle source
# File lib/redi_search/search/clauses/highlight.rb, line 41 def arg_error(msg) raise ArgumentError, "Highlight: #{msg}" end
closing_tag?()
click to toggle source
# File lib/redi_search/search/clauses/highlight.rb, line 53 def closing_tag? if closing_tag.respond_to? :empty? !closing_tag.empty? else closing_tag end end
fields_clause()
click to toggle source
# File lib/redi_search/search/clauses/highlight.rb, line 35 def fields_clause return if fields.empty? ["FIELDS", fields.size, fields] end
opening_tag?()
click to toggle source
# File lib/redi_search/search/clauses/highlight.rb, line 45 def opening_tag? if opening_tag.respond_to? :empty? !opening_tag.empty? else opening_tag end end