org.apache.lucene.search.spans
Class SpanRecordingScorer

Object
  extended by Scorer
      extended by SpanScorer
          extended by SpanRecordingScorer

public class SpanRecordingScorer
extends SpanScorer

Runs a span query and scores the resulting spans, passing them to a SpanHitCollector if specified.


Field Summary
private  String field
          Field being queried (a Span query can only work on one field
private  int maxSpans
          Max # of spans to record (highest scoring are kept, others tossed)
(package private)  int nSpans
          Number of spans recorded for this document
(package private)  int nToDedupe
          How many spans to de-duplicate
(package private)  Span[] posOrder
          Array of recorded spans, in position order
(package private)  int scoredDoc
          Last document that was scored
(package private)  Set terms
          Set of all search terms
(package private)  Span[] toDedupe
          Array to de-dupe, in position order
(package private)  int totalDeduped
          Total deduped, not limited by maxSpans
 
Fields inherited from class SpanScorer
doc, firstTime, freq, more, spans, value, weight
 
Constructor Summary
SpanRecordingScorer(Spans spans, SpanWeight weight, Similarity similarity, int maxSpans)
          Construct a recording scorer.
 
Method Summary
protected  boolean advance()
          Worker method used by SpanScorer.next() and SpanScorer.skipTo(int).
private  void expand()
          Enlarge the arrays used to keep track of spans
 String getField()
           
 int getMaxSpans()
           
 int getSpanCount()
           
 int getSpanDoc()
           
 Span[] getSpans()
           
 Set getTerms()
           
 float score()
           
 
Methods inherited from class SpanScorer
doc, explain, next, skipTo
 
Methods inherited from class Scorer
getSimilarity, score, score
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

field

private String field
Field being queried (a Span query can only work on one field


maxSpans

private int maxSpans
Max # of spans to record (highest scoring are kept, others tossed)


nSpans

int nSpans
Number of spans recorded for this document


scoredDoc

int scoredDoc
Last document that was scored


totalDeduped

int totalDeduped
Total deduped, not limited by maxSpans


posOrder

Span[] posOrder
Array of recorded spans, in position order


toDedupe

Span[] toDedupe
Array to de-dupe, in position order


nToDedupe

int nToDedupe
How many spans to de-duplicate


terms

Set terms
Set of all search terms

Constructor Detail

SpanRecordingScorer

SpanRecordingScorer(Spans spans,
                    SpanWeight weight,
                    Similarity similarity,
                    int maxSpans)
              throws IOException
Construct a recording scorer.

Parameters:
spans - set of spans to process
weight - weight of this query
similarity - used to calculate scores, and compare queries
maxSpans - max # of spans to collect
Throws:
IOException
Method Detail

advance

protected boolean advance()
                   throws IOException
Worker method used by SpanScorer.next() and SpanScorer.skipTo(int).

Overrides:
advance in class SpanScorer
Throws:
IOException

expand

private void expand()
Enlarge the arrays used to keep track of spans


getSpanDoc

public int getSpanDoc()

getField

public String getField()

getSpanCount

public int getSpanCount()

getSpans

public Span[] getSpans()

getMaxSpans

public int getMaxSpans()

getTerms

public Set getTerms()

score

public float score()
            throws IOException
Overrides:
score in class SpanScorer
Throws:
IOException