Package org.apache.lucene.search
Class ExactPhraseMatcher
- java.lang.Object
-
- org.apache.lucene.search.PhraseMatcher
-
- org.apache.lucene.search.ExactPhraseMatcher
-
public final class ExactPhraseMatcher extends PhraseMatcher
Expert: Find exact phrases
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ExactPhraseMatcher.PostingsAndPosition
-
Field Summary
Fields Modifier and Type Field Description private DocIdSetIterator
approximation
private ImpactsDISI
impactsApproximation
private ExactPhraseMatcher.PostingsAndPosition[]
postings
-
Constructor Summary
Constructors Constructor Description ExactPhraseMatcher(PhraseQuery.PostingsAndFreq[] postings, ScoreMode scoreMode, Similarity.SimScorer scorer, float matchCost)
Expert: Creates ExactPhraseMatcher instance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static boolean
advancePosition(ExactPhraseMatcher.PostingsAndPosition posting, int target)
Advance the given pos enum to the first doc on or aftertarget
.(package private) DocIdSetIterator
approximation()
Approximation that only matches documents that have all terms.int
endOffset()
The end offset of the current matchint
endPosition()
The end position of the current match(package private) ImpactsDISI
impactsApproximation()
Approximation that is aware of impacts.(package private) float
maxFreq()
An upper bound on the number of possible matches on this document(package private) static ImpactsSource
mergeImpacts(ImpactsEnum[] impactsEnums)
Merge impacts for multiple terms of an exact phrase.boolean
nextMatch()
Find the next match on the current document, returningfalse
if there are none.void
reset()
Called afterPhraseMatcher.approximation()
has been advanced(package private) float
sloppyWeight()
The slop-adjusted weight of the current matchint
startOffset()
The start offset of the current matchint
startPosition()
The start position of the current match-
Methods inherited from class org.apache.lucene.search.PhraseMatcher
getMatchCost
-
-
-
-
Field Detail
-
postings
private final ExactPhraseMatcher.PostingsAndPosition[] postings
-
approximation
private final DocIdSetIterator approximation
-
impactsApproximation
private final ImpactsDISI impactsApproximation
-
-
Constructor Detail
-
ExactPhraseMatcher
public ExactPhraseMatcher(PhraseQuery.PostingsAndFreq[] postings, ScoreMode scoreMode, Similarity.SimScorer scorer, float matchCost)
Expert: Creates ExactPhraseMatcher instance
-
-
Method Detail
-
approximation
DocIdSetIterator approximation()
Description copied from class:PhraseMatcher
Approximation that only matches documents that have all terms.- Specified by:
approximation
in classPhraseMatcher
-
impactsApproximation
ImpactsDISI impactsApproximation()
Description copied from class:PhraseMatcher
Approximation that is aware of impacts.- Specified by:
impactsApproximation
in classPhraseMatcher
-
maxFreq
float maxFreq()
Description copied from class:PhraseMatcher
An upper bound on the number of possible matches on this document- Specified by:
maxFreq
in classPhraseMatcher
-
advancePosition
private static boolean advancePosition(ExactPhraseMatcher.PostingsAndPosition posting, int target) throws java.io.IOException
Advance the given pos enum to the first doc on or aftertarget
. Returnfalse
if the enum was exhausted before reachingtarget
andtrue
otherwise.- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOException
Description copied from class:PhraseMatcher
Called afterPhraseMatcher.approximation()
has been advanced- Specified by:
reset
in classPhraseMatcher
- Throws:
java.io.IOException
-
nextMatch
public boolean nextMatch() throws java.io.IOException
Description copied from class:PhraseMatcher
Find the next match on the current document, returningfalse
if there are none.- Specified by:
nextMatch
in classPhraseMatcher
- Throws:
java.io.IOException
-
sloppyWeight
float sloppyWeight()
Description copied from class:PhraseMatcher
The slop-adjusted weight of the current matchThe sum of the slop-adjusted weights is used as the freq for scoring
- Specified by:
sloppyWeight
in classPhraseMatcher
-
startPosition
public int startPosition()
Description copied from class:PhraseMatcher
The start position of the current match- Specified by:
startPosition
in classPhraseMatcher
-
endPosition
public int endPosition()
Description copied from class:PhraseMatcher
The end position of the current match- Specified by:
endPosition
in classPhraseMatcher
-
startOffset
public int startOffset() throws java.io.IOException
Description copied from class:PhraseMatcher
The start offset of the current match- Specified by:
startOffset
in classPhraseMatcher
- Throws:
java.io.IOException
-
endOffset
public int endOffset() throws java.io.IOException
Description copied from class:PhraseMatcher
The end offset of the current match- Specified by:
endOffset
in classPhraseMatcher
- Throws:
java.io.IOException
-
mergeImpacts
static ImpactsSource mergeImpacts(ImpactsEnum[] impactsEnums)
Merge impacts for multiple terms of an exact phrase.
-
-