org.apache.lucene.search.spans
Class FieldSpans

Object
  extended by FieldSpans

public class FieldSpans
extends Object

Keeps a record of the matching spans and search terms for each field.


Nested Class Summary
private  class FieldSpans.Entry
          Stores all the information for a field
 
Field Summary
private  HashMap entries
          One FieldSpans.Entry per field
 
Constructor Summary
FieldSpans()
           
 
Method Summary
 void addSpans(FieldSpans other)
          Add matching spans for one or more fields.
 Set getFields()
          Get a set of all the field names
 int getSpanCount(String field)
          Retrieve the number of spans stored for a given field
 Span[] getSpans(String field)
          Retrieve the matching spans for a given field.
 int getSpanTotal(String field)
          Retrieve the total number of spans which matched the field
 Set getTerms(String field)
          Retrieve the set of search terms for a given field
 boolean isEmpty()
          true if no spans have yet been stored
 void recordSpans(String field, int spanTotal, Span[] spans, Set terms)
          Record matching spans for a given field.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entries

private HashMap entries
One FieldSpans.Entry per field

Constructor Detail

FieldSpans

public FieldSpans()
Method Detail

recordSpans

public void recordSpans(String field,
                        int spanTotal,
                        Span[] spans,
                        Set terms)
Record matching spans for a given field.

Parameters:
field - field that was matched
spanTotal - total number of matching spans (which might be more than we're recording if some low-scoring ones dropped off the bottom.)
spans - matching spans
terms - set of all search terms on this field

addSpans

public void addSpans(FieldSpans other)
Add matching spans for one or more fields.

Parameters:
other - set of matching spans

getFields

public Set getFields()
Get a set of all the field names


getSpanTotal

public int getSpanTotal(String field)
Retrieve the total number of spans which matched the field


getSpanCount

public int getSpanCount(String field)
Retrieve the number of spans stored for a given field


getSpans

public Span[] getSpans(String field)
Retrieve the matching spans for a given field. They are always in increasing position order.


getTerms

public Set getTerms(String field)
Retrieve the set of search terms for a given field


isEmpty

public boolean isEmpty()
true if no spans have yet been stored