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.