Package org.apache.lucene.index
Class TermsHashPerField
- java.lang.Object
-
- org.apache.lucene.index.TermsHashPerField
-
- All Implemented Interfaces:
java.lang.Comparable<TermsHashPerField>
- Direct Known Subclasses:
FreqProxTermsWriterPerField
,TermVectorsConsumerPerField
abstract class TermsHashPerField extends java.lang.Object implements java.lang.Comparable<TermsHashPerField>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
TermsHashPerField.PostingsBytesStartArray
-
Field Summary
Fields Modifier and Type Field Description (package private) ByteBlockPool
bytePool
(package private) BytesRefHash
bytesHash
private Counter
bytesUsed
protected DocumentsWriterPerThread.DocState
docState
private boolean
doNextCall
protected FieldInfo
fieldInfo
protected FieldInvertState
fieldState
private static int
HASH_INIT_SIZE
(package private) IntBlockPool
intPool
(package private) int[]
intUptos
(package private) int
intUptoStart
(package private) TermsHashPerField
nextPerField
(package private) int
numPostingInt
(package private) ParallelPostingsArray
postingsArray
(package private) int[]
sortedTermIDs
(package private) int
streamCount
(package private) TermToBytesRefAttribute
termAtt
(package private) ByteBlockPool
termBytePool
protected TermFrequencyAttribute
termFreqAtt
(package private) TermsHash
termsHash
-
Constructor Summary
Constructors Constructor Description TermsHashPerField(int streamCount, FieldInvertState fieldState, TermsHash termsHash, TermsHashPerField nextPerField, FieldInfo fieldInfo)
streamCount: how many streams this field stores per term.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) void
add()
Called once per inverted token.void
add(int textStart)
(package private) abstract void
addTerm(int termID)
Called when a previously seen term is seen again.int
compareTo(TermsHashPerField other)
(package private) abstract ParallelPostingsArray
createPostingsArray(int size)
Creates a new postings array of the specified size.(package private) void
finish()
Finish adding all instances of this field to the current document.void
initReader(ByteSliceReader reader, int termID, int stream)
(package private) abstract void
newPostingsArray()
Called when the postings array is initialized or resized.(package private) abstract void
newTerm(int termID)
Called when a term is seen for the first time.(package private) void
reset()
int[]
sortPostings()
Collapse the hash table and sort in-place; also sets this.sortedTermIDs to the results(package private) boolean
start(IndexableField field, boolean first)
Start adding a new field instance; first is true if this is the first time this field name was seen in the document.(package private) void
writeByte(int stream, byte b)
void
writeBytes(int stream, byte[] b, int offset, int len)
(package private) void
writeVInt(int stream, int i)
-
-
-
Field Detail
-
HASH_INIT_SIZE
private static final int HASH_INIT_SIZE
- See Also:
- Constant Field Values
-
termsHash
final TermsHash termsHash
-
nextPerField
final TermsHashPerField nextPerField
-
docState
protected final DocumentsWriterPerThread.DocState docState
-
fieldState
protected final FieldInvertState fieldState
-
termAtt
TermToBytesRefAttribute termAtt
-
termFreqAtt
protected TermFrequencyAttribute termFreqAtt
-
intPool
final IntBlockPool intPool
-
bytePool
final ByteBlockPool bytePool
-
termBytePool
final ByteBlockPool termBytePool
-
streamCount
final int streamCount
-
numPostingInt
final int numPostingInt
-
fieldInfo
protected final FieldInfo fieldInfo
-
bytesHash
final BytesRefHash bytesHash
-
postingsArray
ParallelPostingsArray postingsArray
-
bytesUsed
private final Counter bytesUsed
-
sortedTermIDs
int[] sortedTermIDs
-
doNextCall
private boolean doNextCall
-
intUptos
int[] intUptos
-
intUptoStart
int intUptoStart
-
-
Constructor Detail
-
TermsHashPerField
public TermsHashPerField(int streamCount, FieldInvertState fieldState, TermsHash termsHash, TermsHashPerField nextPerField, FieldInfo fieldInfo)
streamCount: how many streams this field stores per term. E.g. doc(+freq) is 1 stream, prox+offset is a second.
-
-
Method Detail
-
reset
void reset()
-
initReader
public void initReader(ByteSliceReader reader, int termID, int stream)
-
sortPostings
public int[] sortPostings()
Collapse the hash table and sort in-place; also sets this.sortedTermIDs to the results
-
add
public void add(int textStart) throws java.io.IOException
- Throws:
java.io.IOException
-
add
void add() throws java.io.IOException
Called once per inverted token. This is the primary entry point (for first TermsHash); postings use this API.- Throws:
java.io.IOException
-
writeByte
void writeByte(int stream, byte b)
-
writeBytes
public void writeBytes(int stream, byte[] b, int offset, int len)
-
writeVInt
void writeVInt(int stream, int i)
-
compareTo
public int compareTo(TermsHashPerField other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<TermsHashPerField>
-
finish
void finish() throws java.io.IOException
Finish adding all instances of this field to the current document.- Throws:
java.io.IOException
-
start
boolean start(IndexableField field, boolean first)
Start adding a new field instance; first is true if this is the first time this field name was seen in the document.
-
newTerm
abstract void newTerm(int termID) throws java.io.IOException
Called when a term is seen for the first time.- Throws:
java.io.IOException
-
addTerm
abstract void addTerm(int termID) throws java.io.IOException
Called when a previously seen term is seen again.- Throws:
java.io.IOException
-
newPostingsArray
abstract void newPostingsArray()
Called when the postings array is initialized or resized.
-
createPostingsArray
abstract ParallelPostingsArray createPostingsArray(int size)
Creates a new postings array of the specified size.
-
-