Class TermIntervalsSource
- java.lang.Object
-
- org.apache.lucene.queries.intervals.IntervalsSource
-
- org.apache.lucene.queries.intervals.TermIntervalsSource
-
class TermIntervalsSource extends IntervalsSource
-
-
Field Summary
Fields Modifier and Type Field Description (package private) BytesReftermprivate static intTERM_OPS_PER_POSNumber of simple operations inLucene84PostingsReader.EverythingEnum#nextPosition()when no seek or buffer refill is done.private static intTERM_POSNS_SEEK_OPS_PER_DOCA guess of the average number of simple operations for the initial seek and buffer refill per document for the positions of a term.
-
Constructor Summary
Constructors Constructor Description TermIntervalsSource(BytesRef term)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)inthashCode()IntervalIteratorintervals(java.lang.String field, LeafReaderContext ctx)Create anIntervalIteratorexposing the minimum intervals defined by thisIntervalsSourceReturnsnullif no intervals for this field exist in this segment(package private) static IntervalIteratorintervals(BytesRef term, TermsEnum te)IntervalMatchesIteratormatches(java.lang.String field, LeafReaderContext ctx, int doc)Return aMatchesIteratorover the intervals defined by thisIntervalsSourcefor a given document and field Returnsnullif no intervals exist in the given document and field(package private) static IntervalMatchesIteratormatches(TermsEnum te, int doc, java.lang.String field)intminExtent()Return the minimum possible width of an interval returned by this sourcejava.util.Collection<IntervalsSource>pullUpDisjunctions()Expert: return the set of disjunctions that make up this IntervalsSource Most implementations can returnCollections.singleton(this)(package private) static floattermPositionsCost(TermsEnum termsEnum)Returns an expected cost in simple operations of processing the occurrences of a term in a document that contains the term.java.lang.StringtoString()voidvisit(java.lang.String field, QueryVisitor visitor)Expert: visit the tree of sources
-
-
-
Field Detail
-
term
final BytesRef term
-
TERM_POSNS_SEEK_OPS_PER_DOC
private static final int TERM_POSNS_SEEK_OPS_PER_DOC
A guess of the average number of simple operations for the initial seek and buffer refill per document for the positions of a term. See alsoLucene84PostingsReader.EverythingEnum#nextPosition().Aside: Instead of being constant this could depend among others on
Lucene84PostingsFormat.BLOCK_SIZE,TermsEnum.docFreq(),TermsEnum.totalTermFreq(),DocIdSetIterator.cost()(expected number of matching docs),IndexReader.maxDoc()(total number of docs in the segment), and the seek time and block size of the device storing the index.- See Also:
- Constant Field Values
-
TERM_OPS_PER_POS
private static final int TERM_OPS_PER_POS
Number of simple operations inLucene84PostingsReader.EverythingEnum#nextPosition()when no seek or buffer refill is done.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TermIntervalsSource
TermIntervalsSource(BytesRef term)
-
-
Method Detail
-
intervals
public IntervalIterator intervals(java.lang.String field, LeafReaderContext ctx) throws java.io.IOException
Description copied from class:IntervalsSourceCreate anIntervalIteratorexposing the minimum intervals defined by thisIntervalsSourceReturnsnullif no intervals for this field exist in this segment- Specified by:
intervalsin classIntervalsSource- Parameters:
field- the field to read positions fromctx- the context for which to return the iterator- Throws:
java.io.IOException
-
intervals
static IntervalIterator intervals(BytesRef term, TermsEnum te) throws java.io.IOException
- Throws:
java.io.IOException
-
matches
public IntervalMatchesIterator matches(java.lang.String field, LeafReaderContext ctx, int doc) throws java.io.IOException
Description copied from class:IntervalsSourceReturn aMatchesIteratorover the intervals defined by thisIntervalsSourcefor a given document and field Returnsnullif no intervals exist in the given document and field- Specified by:
matchesin classIntervalsSource- Parameters:
field- the field to read positions fromctx- the document's contextdoc- the document to return matches for- Throws:
java.io.IOException
-
matches
static IntervalMatchesIterator matches(TermsEnum te, int doc, java.lang.String field) throws java.io.IOException
- Throws:
java.io.IOException
-
minExtent
public int minExtent()
Description copied from class:IntervalsSourceReturn the minimum possible width of an interval returned by this source- Specified by:
minExtentin classIntervalsSource
-
pullUpDisjunctions
public java.util.Collection<IntervalsSource> pullUpDisjunctions()
Description copied from class:IntervalsSourceExpert: return the set of disjunctions that make up this IntervalsSource Most implementations can returnCollections.singleton(this)- Specified by:
pullUpDisjunctionsin classIntervalsSource
-
hashCode
public int hashCode()
- Specified by:
hashCodein classIntervalsSource
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equalsin classIntervalsSource
-
toString
public java.lang.String toString()
- Specified by:
toStringin classIntervalsSource
-
visit
public void visit(java.lang.String field, QueryVisitor visitor)Description copied from class:IntervalsSourceExpert: visit the tree of sources- Specified by:
visitin classIntervalsSource
-
termPositionsCost
static float termPositionsCost(TermsEnum termsEnum) throws java.io.IOException
Returns an expected cost in simple operations of processing the occurrences of a term in a document that contains the term. This is for use byTwoPhaseIterator.matchCost()implementations.- Parameters:
termsEnum- The term is the term at which this TermsEnum is positioned.- Throws:
java.io.IOException
-
-