Class STBlockReader
- java.lang.Object
-
- org.apache.lucene.index.TermsEnum
-
- org.apache.lucene.index.BaseTermsEnum
-
- org.apache.lucene.codecs.uniformsplit.BlockReader
-
- org.apache.lucene.codecs.uniformsplit.sharedterms.STBlockReader
-
- All Implemented Interfaces:
Accountable
,BytesRefIterator
- Direct Known Subclasses:
STMergingBlockReader
public class STBlockReader extends BlockReader
Reads terms blocks with the Shared Terms format.- See Also:
STBlockWriter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.index.TermsEnum
TermsEnum.SeekStatus
-
-
Field Summary
Fields Modifier and Type Field Description protected FieldInfos
fieldInfos
-
Fields inherited from class org.apache.lucene.codecs.uniformsplit.BlockReader
blockDecoder, blockFirstLineStart, blockHeader, blockHeaderReader, blockInput, blockLine, blockLineReader, blockReadBuffer, blockStartFP, dictionaryBrowser, dictionaryBrowserSupplier, fieldMetadata, forcedTerm, lineIndexInBlock, postingsReader, scratchBlockBytes, scratchBlockLine, scratchTermState, termState, termStateForced, termStateSerializer, termStatesReadBuffer
-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Constructor Description STBlockReader(IndexDictionary.BrowserSupplier dictionaryBrowserSupplier, IndexInput blockInput, PostingsReaderBase postingsReader, FieldMetadata fieldMetadata, BlockDecoder blockDecoder, FieldInfos fieldInfos)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected STBlockLine.Serializer
createBlockLineSerializer()
protected boolean
isBeyondLastTerm(BytesRef searchedTerm, long blockStartFP)
Indicates whether the searched term is beyond the last term of the field.BytesRef
next()
Increments the iteration to the nextBytesRef
in the iterator.protected BytesRef
nextTerm()
Moves to the next term line and reads it, whichever are the corresponding fields.protected BlockTermState
readTermState()
Reads theBlockTermState
on the current line for this reader's field.TermsEnum.SeekStatus
seekCeil(BytesRef searchedTerm)
Seeks to the specified term, if it exists, or to the next (ceiling) term.(package private) TermsEnum.SeekStatus
seekCeilIgnoreField(BytesRef searchedTerm)
boolean
seekExact(BytesRef searchedTerm)
Attempts to seek to the exact term, returning true if the term is found.private boolean
termOccursInField()
-
Methods inherited from class org.apache.lucene.codecs.uniformsplit.BlockReader
clearTermState, compareToMiddleAndJump, createBlockHeaderSerializer, createDeltaBaseTermStateSerializer, decodeBlockBytesIfNeeded, docFreq, getOrCreateDictionaryBrowser, impacts, initializeBlockReadLazily, initializeHeader, isCurrentTerm, newCorruptIndexException, ord, postings, ramBytesUsed, readHeader, readLineInBlock, readTermStateIfNotRead, seekExact, seekExact, seekInBlock, seekInBlock, term, termState, totalTermFreq
-
Methods inherited from class org.apache.lucene.index.BaseTermsEnum
attributes
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Field Detail
-
fieldInfos
protected final FieldInfos fieldInfos
-
-
Constructor Detail
-
STBlockReader
public STBlockReader(IndexDictionary.BrowserSupplier dictionaryBrowserSupplier, IndexInput blockInput, PostingsReaderBase postingsReader, FieldMetadata fieldMetadata, BlockDecoder blockDecoder, FieldInfos fieldInfos) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
next
public BytesRef next() throws java.io.IOException
Description copied from interface:BytesRefIterator
Increments the iteration to the nextBytesRef
in the iterator. Returns the resultingBytesRef
ornull
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.- Specified by:
next
in interfaceBytesRefIterator
- Overrides:
next
in classBlockReader
- Returns:
- the next
BytesRef
in the iterator ornull
if the end of the iterator is reached. - Throws:
java.io.IOException
- If there is a low-level I/O error.
-
termOccursInField
private boolean termOccursInField() throws java.io.IOException
- Throws:
java.io.IOException
-
nextTerm
protected BytesRef nextTerm() throws java.io.IOException
Moves to the next term line and reads it, whichever are the corresponding fields. The term details are not read yet. They will be read only when needed withBlockReader.readTermStateIfNotRead()
.- Overrides:
nextTerm
in classBlockReader
- Returns:
- The read term bytes.
- Throws:
java.io.IOException
-
seekCeil
public TermsEnum.SeekStatus seekCeil(BytesRef searchedTerm) throws java.io.IOException
Description copied from class:TermsEnum
Seeks to the specified term, if it exists, or to the next (ceiling) term. Returns SeekStatus to indicate whether exact term was found, a different term was found, or EOF was hit. The target term may be before or after the current term. If this returns SeekStatus.END, the enum is unpositioned.- Overrides:
seekCeil
in classBlockReader
- Throws:
java.io.IOException
-
seekCeilIgnoreField
TermsEnum.SeekStatus seekCeilIgnoreField(BytesRef searchedTerm) throws java.io.IOException
- Throws:
java.io.IOException
-
seekExact
public boolean seekExact(BytesRef searchedTerm) throws java.io.IOException
Description copied from class:TermsEnum
Attempts to seek to the exact term, returning true if the term is found. If this returns false, the enum is unpositioned. For some codecs, seekExact may be substantially faster thanTermsEnum.seekCeil(org.apache.lucene.util.BytesRef)
.- Overrides:
seekExact
in classBlockReader
- Returns:
- true if the term is found; return false if the enum is unpositioned.
- Throws:
java.io.IOException
-
isBeyondLastTerm
protected boolean isBeyondLastTerm(BytesRef searchedTerm, long blockStartFP)
Description copied from class:BlockReader
Indicates whether the searched term is beyond the last term of the field.- Overrides:
isBeyondLastTerm
in classBlockReader
blockStartFP
- The current block start file pointer.
-
createBlockLineSerializer
protected STBlockLine.Serializer createBlockLineSerializer()
- Overrides:
createBlockLineSerializer
in classBlockReader
-
readTermState
protected BlockTermState readTermState() throws java.io.IOException
Reads theBlockTermState
on the current line for this reader's field.- Overrides:
readTermState
in classBlockReader
- Returns:
- The
BlockTermState
; or null if the term does not occur for the field. - Throws:
java.io.IOException
-
-