public class IntersectBlockReader extends BlockReader
TermsEnum
response to UniformSplitTerms.intersect(CompiledAutomaton, BytesRef)
,
intersecting the terms with an automaton.Modifier and Type | Class and Description |
---|---|
protected static class |
IntersectBlockReader.AutomatonNextTermCalculator
This is a copy of AutomatonTermsEnum.
|
TermsEnum.SeekStatus
Modifier and Type | Field and Description |
---|---|
protected boolean |
beyondCommonPrefix
Whether the current term is beyond the automaton common prefix.
|
protected int |
blockPrefixLen |
protected int |
blockPrefixRunAutomatonState |
protected BytesRef |
commonPrefixRef |
protected BytesRef |
commonSuffixRef |
protected IntersectBlockReader.AutomatonNextTermCalculator |
nextStringCalculator |
protected int |
numBytesAccepted
Number of bytes accepted by the last call to
runAutomatonForState(byte[], int, int, int) . |
protected ByteRunAutomaton |
runAutomaton |
protected BytesRef |
seekTerm
Set this when our current mode is seeking to this term.
|
protected BytesRef |
startTerm |
blockDecoder, blockFirstLineStart, blockHeader, blockInput, blockLine, blockLineReader, blockReadBuffer, blockStartFP, dictionaryBrowser, dictionaryBrowserSupplier, fieldMetadata, forcedTerm, lineIndexInBlock, postingsReader, scratchBlockBytes, scratchTermState, termState, termStateForced, termStateSerializer, termStatesReadBuffer
Constructor and Description |
---|
IntersectBlockReader(CompiledAutomaton compiled,
BytesRef startTerm,
DictionaryBrowserSupplier dictionaryBrowserSupplier,
IndexInput blockInput,
PostingsReaderBase postingsReader,
FieldMetadata fieldMetadata,
BlockDecoder blockDecoder) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
isBeyondCommonPrefix(BytesRef bytesRef)
Determines if the provided
BytesRef is beyond the automaton common prefix. |
BytesRef |
next()
Increments the iteration to the next
BytesRef in the iterator. |
protected boolean |
nextBlockMatchingPrefix()
Find the next block that appears to contain terms that could match the automata.
|
protected BytesRef |
nextTermInBlockMatching()
Find the next block line that matches, or null when at end of block.
|
protected int |
runAutomatonForState(byte[] s,
int offset,
int length,
int initialState)
Run the automaton and return the final state (not necessary accepted).
|
protected boolean |
runAutomatonFromPrefix(BytesRef term) |
TermsEnum.SeekStatus |
seekCeil(BytesRef text)
Seeks to the specified term, if it exists, or to the
next (ceiling) term.
|
boolean |
seekExact(BytesRef text)
Attempts to seek to the exact term, returning true if the term is found.
|
void |
seekExact(BytesRef term,
TermState state)
Positions this
BlockReader without re-seeking the term dictionary. |
void |
seekExact(long ord)
Not supported.
|
clearTermState, compareToMiddleAndJump, decodeBlockBytesIfNeeded, docFreq, getOrCreateDictionaryBrowser, impacts, initializeBlockReadLazily, initializeHeader, isBeyondLastTerm, isCurrentTerm, nextTerm, ord, postings, ramBytesUsed, readHeader, readLineInBlock, readTermState, readTermStateIfNotRead, seekInBlock, seekInBlock, term, termState, totalTermFreq
attributes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildResources
protected final IntersectBlockReader.AutomatonNextTermCalculator nextStringCalculator
protected final ByteRunAutomaton runAutomaton
protected final BytesRef commonSuffixRef
protected final BytesRef commonPrefixRef
protected final BytesRef startTerm
protected BytesRef seekTerm
protected int blockPrefixRunAutomatonState
protected int blockPrefixLen
protected int numBytesAccepted
runAutomatonForState(byte[], int, int, int)
.protected boolean beyondCommonPrefix
public IntersectBlockReader(CompiledAutomaton compiled, BytesRef startTerm, DictionaryBrowserSupplier dictionaryBrowserSupplier, IndexInput blockInput, PostingsReaderBase postingsReader, FieldMetadata fieldMetadata, BlockDecoder blockDecoder) throws java.io.IOException
java.io.IOException
public BytesRef next() throws java.io.IOException
BytesRefIterator
BytesRef
in the iterator.
Returns the resulting BytesRef
or null
if the end of
the iterator is reached. The returned BytesRef may be re-used across calls
to next. After this method returns null, do not call it again: the results
are undefined.next
in interface BytesRefIterator
next
in class BlockReader
BytesRef
in the iterator or null
if
the end of the iterator is reached.java.io.IOException
- If there is a low-level I/O error.protected boolean nextBlockMatchingPrefix() throws java.io.IOException
java.io.IOException
protected BytesRef nextTermInBlockMatching() throws java.io.IOException
java.io.IOException
protected boolean runAutomatonFromPrefix(BytesRef term)
protected int runAutomatonForState(byte[] s, int offset, int length, int initialState)
numBytesAccepted
with the offset of the first byte rejected by the automaton;
or (offset + length) if no byte is rejected.protected boolean isBeyondCommonPrefix(BytesRef bytesRef)
BytesRef
is beyond the automaton common prefix.
This method must be called after a call to runAutomatonForState(byte[], int, int, int)
because
it uses numBytesAccepted
value.public boolean seekExact(BytesRef text)
TermsEnum
TermsEnum.seekCeil(org.apache.lucene.util.BytesRef)
.
seekExact
in class BlockReader
public void seekExact(long ord)
BlockReader
seekExact
in class BlockReader
public TermsEnum.SeekStatus seekCeil(BytesRef text)
TermsEnum
seekCeil
in class BlockReader
public void seekExact(BytesRef term, TermState state)
BlockReader
BlockReader
without re-seeking the term dictionary.
The block containing the term is not read by this method. It will be read
lazily only if needed, for example if BlockReader.next()
is called.
Calling BlockReader.postings(org.apache.lucene.index.PostingsEnum, int)
after this method does require the block to be read.
seekExact
in class BlockReader
term
- the term the TermState corresponds tostate
- the TermState