Sha256: dc960bea0cea402b2a88dde24bee33070a3641baea051a2d235c62533c01d0eb
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
module Sunspot module Query # # A query component that builds parameters for requesting highlights # class Highlighting #:nodoc: def initialize(fields=[], options={}) @fields = fields @options = options end # # Return Solr highlighting params # def to_params params = { :hl => 'on', :"hl.simple.pre" => '@@@hl@@@', :"hl.simple.post" => '@@@endhl@@@' } unless @fields.empty? params[:"hl.fl"] = @fields.map { |field| field.indexed_name } end if max_snippets = @options[:max_snippets] params[:"hl.snippets"] = max_snippets end if fragment_size = @options[:fragment_size] params[:"hl.fragsize"] = fragment_size end if @options[:merge_contiguous_fragments] params[:"hl.mergeContiguous"] = 'true' end if @options[:phrase_highlighter] params[:"hl.usePhraseHighlighter"] = 'true' if @options[:require_field_match] params[:"hl.requireFieldMatch"] = 'true' end end params end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sunspot-0.10.5 | lib/sunspot/query/highlighting.rb |
sunspot-0.10.4 | lib/sunspot/query/highlighting.rb |
sunspot-0.10.3 | lib/sunspot/query/highlighting.rb |