Class RDig::Search::Highlighter
In: lib/rdig/highlight.rb
Parent: Object

beginning of a port of the Query term highlighter from Lucene contrib

Methods

Public Class methods

[Source]

   # File lib/rdig/highlight.rb, line 6
6:       def initialize
7:         @analyzer = RDig.config.ferret.analyzer
8:       end

Public Instance methods

[Source]

    # File lib/rdig/highlight.rb, line 9
 9:       def best_fragments(scorer, text, max_fragments = 1)
10:         token_stream = @analyzer.token_stream('body', text)
11:         frag_texts = []
12:         get_best_text_fragments(token_stream, text, max_fragments).each { |frag|
13:           frag_texts << frag.to_s if (frag && frag.score > 0)
14:         }
15:         return frag_texts
16:       end

[Source]

    # File lib/rdig/highlight.rb, line 18
18:       def get_best_text_fragments(token_stream, text, max_fragments)
19:         
20:       end

[Validate]