Class SimpleSpanFragmenter
- java.lang.Object
-
- org.apache.lucene.search.highlight.SimpleSpanFragmenter
-
- All Implemented Interfaces:
Fragmenter
public class SimpleSpanFragmenter extends java.lang.Object implements Fragmenter
Fragmenter
implementation which breaks text up into same-size fragments but does not split upSpans
. This is a simple sample class.
-
-
Constructor Summary
Constructors Constructor Description SimpleSpanFragmenter(QueryScorer queryScorer)
SimpleSpanFragmenter(QueryScorer queryScorer, int fragmentSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isNewFragment()
Test to see if this token from the stream should be held in a new TextFragment.void
start(java.lang.String originalText, TokenStream tokenStream)
Initializes the Fragmenter.
-
-
-
Constructor Detail
-
SimpleSpanFragmenter
public SimpleSpanFragmenter(QueryScorer queryScorer)
- Parameters:
queryScorer
- QueryScorer that was used to score hits
-
SimpleSpanFragmenter
public SimpleSpanFragmenter(QueryScorer queryScorer, int fragmentSize)
- Parameters:
queryScorer
- QueryScorer that was used to score hitsfragmentSize
- size in bytes of each fragment
-
-
Method Detail
-
isNewFragment
public boolean isNewFragment()
Description copied from interface:Fragmenter
Test to see if this token from the stream should be held in a new TextFragment. Every time this is called, the TokenStream passed to start(String, TokenStream) will have been incremented.- Specified by:
isNewFragment
in interfaceFragmenter
-
start
public void start(java.lang.String originalText, TokenStream tokenStream)
Description copied from interface:Fragmenter
Initializes the Fragmenter. You can grab references to the Attributes you are interested in from tokenStream and then access the values inFragmenter.isNewFragment()
.- Specified by:
start
in interfaceFragmenter
- Parameters:
originalText
- the original source texttokenStream
- theTokenStream
to be fragmented
-
-