org.apache.lucene.search
Class FieldSpanSource

Object
  extended by FieldSpanSource

public class FieldSpanSource
extends Object

This class, an instance of which is passed to a SpanHitCollector for each hit, retrieves FieldSpans when requested. This is performed lazily so that it can be avoided for hits that don't make the grade.


Nested Class Summary
private static class FieldSpanSource.ScoreComparator
          Used to sort spans by descending score, then by position
private  class FieldSpanSource.ScoreOrder
          Keeps track of the next and previous spans, in score order
 
Field Summary
(package private)  int curDoc
           
(package private)  String[] fields
           
(package private)  FieldSpanSource.ScoreOrder[] scoreOrder
           
(package private)  SpanRecordingScorer[][] scorersPerField
           
private static FieldSpanSource.ScoreComparator theScoreComparator
           
 
Constructor Summary
FieldSpanSource(SpanRecordingScorer[] scorers)
          Package-private on purpose.
 
Method Summary
private  void addSpans(int doc, String field, SpanRecordingScorer[] scorers, FieldSpans out)
          For the given field and list of scorers, calculate (and deduplicate if necessary) the spans for that field.
 FieldSpans getSpans(int doc)
          Retrieve the spans for the given document.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fields

String[] fields

scorersPerField

SpanRecordingScorer[][] scorersPerField

scoreOrder

FieldSpanSource.ScoreOrder[] scoreOrder

curDoc

int curDoc

theScoreComparator

private static FieldSpanSource.ScoreComparator theScoreComparator
Constructor Detail

FieldSpanSource

FieldSpanSource(SpanRecordingScorer[] scorers)
Package-private on purpose. Should only be created by RecordingSearcher.

Method Detail

getSpans

public FieldSpans getSpans(int doc)
Retrieve the spans for the given document.

Parameters:
doc - Document to get spans for. Typically, the FieldSpanSource can only get spans for the most recent document collected.
Returns:
Recorded spans for the document.

addSpans

private void addSpans(int doc,
                      String field,
                      SpanRecordingScorer[] scorers,
                      FieldSpans out)
For the given field and list of scorers, calculate (and deduplicate if necessary) the spans for that field.

Parameters:
doc - Document for which spans are being recorded
field - The field being considered
scorers - All scorers for that field
out - Where to store the resulting spans.