public class BlockTreeTermsWriter extends FieldsConsumer
Writes terms dict and index, block-encoding (column stride) each term's metadata for each set of terms between two index terms.
Files:
The .tim file contains the list of terms in each field along with per-term statistics (such as docfreq) and per-term metadata (typically pointers to the postings list for that term in the inverted index).
The .tim is arranged in blocks: with blocks containing a variable number of entries (by default 25-48), where each entry is either a term or a reference to a sub-block.
NOTE: The term dictionary can plug into different postings implementations: the postings writer/reader are actually responsible for encoding and decoding the Postings Metadata and Term Metadata sections.
CodecHeader
Uint64
VInt
VLong
Notes:
CodecHeader
storing the version information
for the BlockTree implementation.FieldInfos
. (.fnm)The .tip file contains an index into the term dictionary, so that it can be accessed randomly. The index is also used to determine when a given term cannot exist on disk (in the .tim file), saving a disk seek.
CodecHeader
Uint64
VLong
FST<byte[]>
Notes:
BlockTreeTermsReader
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_BLOCK_SIZE
Suggested default value for the
maxItemsInBlock parameter to BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int) . |
static int |
DEFAULT_MIN_BLOCK_SIZE
Suggested default value for the
minItemsInBlock parameter to BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int) . |
static int |
TERMS_INDEX_VERSION_APPEND_ONLY
Append-only
|
static int |
TERMS_INDEX_VERSION_CURRENT
Current index format.
|
static int |
TERMS_INDEX_VERSION_START
Initial index format.
|
static int |
TERMS_VERSION_APPEND_ONLY
Append-only
|
static int |
TERMS_VERSION_CURRENT
Current terms format.
|
static int |
TERMS_VERSION_START
Initial terms format.
|
Constructor and Description |
---|
BlockTreeTermsWriter(SegmentWriteState state,
PostingsWriterBase postingsWriter,
int minItemsInBlock,
int maxItemsInBlock)
Create a new writer.
|
Modifier and Type | Method and Description |
---|---|
TermsConsumer |
addField(FieldInfo field)
Add a new field
|
void |
close()
Called when we are done adding everything.
|
protected void |
writeHeader(IndexOutput out)
Writes the terms file header.
|
protected void |
writeIndexHeader(IndexOutput out)
Writes the index file header.
|
protected void |
writeIndexTrailer(IndexOutput indexOut,
long dirStart)
Writes the index file trailer.
|
protected void |
writeTrailer(IndexOutput out,
long dirStart)
Writes the terms file trailer.
|
merge
public static final int DEFAULT_MIN_BLOCK_SIZE
minItemsInBlock
parameter to BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)
.public static final int DEFAULT_MAX_BLOCK_SIZE
maxItemsInBlock
parameter to BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)
.public static final int TERMS_VERSION_START
public static final int TERMS_VERSION_APPEND_ONLY
public static final int TERMS_VERSION_CURRENT
public static final int TERMS_INDEX_VERSION_START
public static final int TERMS_INDEX_VERSION_APPEND_ONLY
public static final int TERMS_INDEX_VERSION_CURRENT
public BlockTreeTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter, int minItemsInBlock, int maxItemsInBlock) throws IOException
IOException
protected void writeHeader(IndexOutput out) throws IOException
IOException
protected void writeIndexHeader(IndexOutput out) throws IOException
IOException
protected void writeTrailer(IndexOutput out, long dirStart) throws IOException
IOException
protected void writeIndexTrailer(IndexOutput indexOut, long dirStart) throws IOException
IOException
public TermsConsumer addField(FieldInfo field) throws IOException
FieldsConsumer
addField
in class FieldsConsumer
IOException
public void close() throws IOException
FieldsConsumer
close
in interface Closeable
close
in class FieldsConsumer
IOException
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.