Package org.apache.lucene.mark

This package provides the ability to mark terms, spans, and context around spans within the contents of a stored document field.

See:
          Description

Interface Summary
MarkCollector Receives callbacks to mark terms, context start/end, and span start/end notifications from ContextMarker.
WordIter Interface for iterating over the contents of a field or document on a word-oriented basis.
 

Class Summary
BasicMarkPos Stores a position within a single document field.
BasicWordIter Utility class used to iterate either forward or backward through the tokens in a single string of text.
ContextMarker Workhorse class that handles marking hits, context surrounding hits, and search terms.
MarkPos Represents an abstract position within the text of a document.
 

Package org.apache.lucene.mark Description

This package provides the ability to mark terms, spans, and context around spans within the contents of a stored document field.

Here are the general steps to use this functionality:

  1. Create a query using Lucene's Span system (i.e. use classes derived from SpanQuery).
  2. On the top level query, turn on span recording by calling setSpanRecording() on the query.
  3. Run the query. Each Document returned will in reality be a SpanDocument.
  4. Call one of the markField() methods of SpanDocument and supply a MarkCollector to collect the resulting marks.