|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.mg4j.index.IndexReader
it.unimi.dsi.mg4j.index.SkipIndexReader
Provides facilities to read a skip inverted index from an InputBitStream
.
Please consult the SkipIndexWriter
documentation for more information about
the structure of a skip inverted index.
This class is used to read inverted lists with skips. Its
functioning is completely analogous to IndexReader
.
Note that Index
provides a much easier interface to
index access. Instead of creating an IndexReader
explicitly, you can use Index.getReader()
.
Field Summary | |
protected static int |
BEFORE_TOWER
This value of IndexReader.state means that we are positioned
just before a tower. |
protected static int |
FIRST_UNUSED_STATE
This is the first unused state. |
protected SkipIndex |
skipIndex
The reference skip index. |
Fields inherited from class it.unimi.dsi.mg4j.index.IndexReader |
b, BEFORE_COUNT, BEFORE_FREQUENCY, BEFORE_POINTER, BEFORE_POSITIONS, count, currentDocument, frequency, ibs, index, log2b, numberOfDocumentRecord, relativeFrequency, state, term |
Fields inherited from interface it.unimi.dsi.mg4j.index.CompressionFlags |
ARITH, CODING_NAME, COUNTS_DEFAULT, COUNTS_DELTA, COUNTS_GAMMA, COUNTS_SHIFT, DELTA, FREQUENCIES_DEFAULT, FREQUENCIES_DELTA, FREQUENCIES_GAMMA, FREQUENCIES_SHIFT, GAMMA, GOLOMB, INTERP, NIBBLE, NO_COUNTS, NO_POSITIONS, NONE, POINTERS_DEFAULT, POINTERS_DELTA, POINTERS_GAMMA, POINTERS_GOLOMB, POINTERS_SHIFT, POSITIONS_ARITH, POSITIONS_DEFAULT, POSITIONS_DELTA, POSITIONS_GAMMA, POSITIONS_GOLOMB, POSITIONS_INTERP, POSITIONS_SHIFT, POSITIONS_SKEWED_GOLOMB, SKEWED_GOLOMB, UNARY, ZETA |
Constructor Summary | |
SkipIndexReader(Index index)
Creates a new skip index reader, with the specified underlying Index and default buffer size. |
|
SkipIndexReader(Index index,
InputBitStream ibs)
Creates a new skip index reader, with the specified underlying Index and input bit stream. |
|
SkipIndexReader(Index index,
int bufferSize)
Creates a new skip index reader, with the specified underlying Index . |
|
SkipIndexReader(InputBitStream ibs,
int N,
long flags,
int q,
int h)
Deprecated. Please use Index.getReader() or IndexReader.IndexReader(Index) . |
|
SkipIndexReader(InputBitStream ibs,
LongList offsets,
IntList sizes,
int N,
long flags,
int q,
int h)
Deprecated. Please use Index.getReader() or IndexReader.IndexReader(Index) . |
|
SkipIndexReader(InputBitStream ibs,
LongList offsets,
int N,
long flags,
int q,
int h)
Deprecated. Please use Index.getReader() or IndexReader.IndexReader(Index) . |
Method Summary | |
protected boolean |
justAfterPointer()
Returns true if we are positioned just after a pointer. |
int |
readDocumentPointer()
Reads a document pointer from a given InputBitStream . |
int |
readFrequency()
Reads and returns the frequency (number of documents where the term appears). |
int |
readPositionCount()
Reads the position count for the current document. |
boolean |
skipTo(int p)
Skips to the first document record whose document pointer is greater than or equal to the given value. |
String |
toString()
|
Methods inherited from class it.unimi.dsi.mg4j.index.IndexReader |
close, currentDocumentPointer, documents, documents, endOfList, position, readBits, readDocumentPositions |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected final SkipIndex skipIndex
IndexReader.index
to
avoid excessive type casting.
protected static final int BEFORE_TOWER
IndexReader.state
means that we are positioned
just before a tower.
protected static final int FIRST_UNUSED_STATE
Constructor Detail |
public SkipIndexReader(Index index) throws IOException
Index
and default buffer size.
index
- the index.public SkipIndexReader(Index index, int bufferSize) throws IOException
Index
.
index
- the index.bufferSize
- the size of the buffer of the underlying input bit stream.public SkipIndexReader(Index index, InputBitStream ibs) throws IOException
Index
and input bit stream.
index
- the index.ibs
- the underlying bit stream.public SkipIndexReader(InputBitStream ibs, LongList offsets, IntList sizes, int N, long flags, int q, int h) throws IOException
Index.getReader()
or IndexReader.IndexReader(Index)
.
InputBitStream
.
ibs
- the underlying input bit stream.offsets
- the offset list; may be null
if you do not plan using IndexReader.position(int)
.sizes
- the size list; may be null
if your code does not require it.N
- the number of documents in the collection.flags
- a bit mask setting the coding techniques to be used (see the IndexReader
introduction).q
- the quantum.h
- the maximum height of a skip tower.public SkipIndexReader(InputBitStream ibs, LongList offsets, int N, long flags, int q, int h) throws IOException
Index.getReader()
or IndexReader.IndexReader(Index)
.
InputBitStream
.
ibs
- the underlying input bit stream.offsets
- the offset list; may be null
if you do not plan using IndexReader.position(int)
.N
- the number of documents in the collection.flags
- a bit mask setting the coding techniques to be used (see the IndexReader
introduction).q
- the quantum.h
- the maximum height of a skip tower.public SkipIndexReader(InputBitStream ibs, int N, long flags, int q, int h) throws IOException
Index.getReader()
or IndexReader.IndexReader(Index)
.
InputBitStream
.
ibs
- the underlying input bit stream.N
- the number of documents in the collection.flags
- a bit mask setting the coding techniques to be used (see the IndexReader
introduction).q
- the quantum.h
- the maximum height of a skip tower.Method Detail |
public int readFrequency() throws IOException, IllegalStateException
IndexReader
IndexReader.endOfList()
must
return true, but also all data contained in the last document record must
have been read).
After that, you are ready to read the document records.
readFrequency
in class IndexReader
IOException
- if an exception is thrown by the underlying stream
IllegalStateException
public int readDocumentPointer() throws IOException
IndexReader
InputBitStream
. This
method returns the document pointer; after this, you can use the stream
to read the positions.
readDocumentPointer
in class IndexReader
IOException
- if an exception is thrown by the underlying streampublic int readPositionCount() throws IOException
IndexReader
readPositionCount
in class IndexReader
IOException
- if an exception is thrown by the underlying streamprotected boolean justAfterPointer()
justAfterPointer
in class IndexReader
public boolean skipTo(int p) throws IOException
IndexReader
If this method returns true, then there is one record satisfying the condition, and the index is positioned over it. If this method returns false, then the condition is not satisfied and the index is positioned on the last document record.
In any case, this method leaves the index in the same state as after a call to
IndexReader.readDocumentPointer()
, unless it is called when IndexReader.endOfList()
is true,
in which case it does nothing and returns false.
skipTo
in class IndexReader
p
- a document pointer.
p
.
IOException
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |