public abstract class PostingsWriterBase extends PostingsConsumer implements Closeable
PostingsConsumer
to support pluggable term dictionaries.
This class contains additional hooks to interact with the provided
term dictionaries such as BlockTreeTermsWriter
. If you want
to re-use an existing implementation and are only interested in
customizing the format of the postings list, extend this class
instead.
PostingsReaderBase
Modifier | Constructor and Description |
---|---|
protected |
PostingsWriterBase()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
close() |
abstract void |
encodeTerm(long[] longs,
DataOutput out,
FieldInfo fieldInfo,
BlockTermState state,
boolean absolute)
Encode metadata as long[] and byte[].
|
abstract void |
finishTerm(BlockTermState state)
Finishes the current term.
|
abstract void |
init(IndexOutput termsOut)
Called once after startup, before any terms have been
added.
|
abstract BlockTermState |
newTermState()
Return a newly created empty TermState
|
abstract int |
setField(FieldInfo fieldInfo)
Sets the current field for writing, and returns the
fixed length of long[] metadata (which is fixed per
field), called when the writing switches to another field.
|
abstract void |
startTerm()
Start a new term.
|
addPosition, finishDoc, merge, startDoc
protected PostingsWriterBase()
public abstract void init(IndexOutput termsOut) throws IOException
termsOut
.IOException
public abstract BlockTermState newTermState() throws IOException
IOException
public abstract void startTerm() throws IOException
finishTerm(BlockTermState)
is done, only if the term has at least one
document.IOException
public abstract void finishTerm(BlockTermState state) throws IOException
BlockTermState
contains the term's summary statistics,
and will holds metadata from PBF when returnedIOException
public abstract void encodeTerm(long[] longs, DataOutput out, FieldInfo fieldInfo, BlockTermState state, boolean absolute) throws IOException
absolute
controls whether
current term is delta encoded according to latest term.
Usually elements in longs
are file pointers, so each one always
increases when a new term is consumed. out
is used to write generic
bytes, which are not monotonic.
NOTE: sometimes long[] might contain "don't care" values that are unused, e.g.
the pointer to postings list may not be defined for some terms but is defined
for others, if it is designed to inline some postings data in term dictionary.
In this case, the postings writer should always use the last value, so that each
element in metadata long[] remains monotonic.IOException
public abstract int setField(FieldInfo fieldInfo)
public abstract void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.