Class QuasiSuccinctIndexReader.AbstractQuasiSuccinctIndexIterator
- java.lang.Object
-
- it.unimi.di.big.mg4j.index.AbstractIndexIterator
-
- it.unimi.di.big.mg4j.index.QuasiSuccinctIndexReader.AbstractQuasiSuccinctIndexIterator
-
- All Implemented Interfaces:
IndexIterator
,DocumentIterator
- Direct Known Subclasses:
QuasiSuccinctIndexReader.EliasFanoIndexIterator
,QuasiSuccinctIndexReader.RankedIndexIterator
- Enclosing class:
- QuasiSuccinctIndexReader
protected abstract static class QuasiSuccinctIndexReader.AbstractQuasiSuccinctIndexIterator extends AbstractIndexIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected long
count
The count of the current posting, or -1 if it is not known.protected QuasiSuccinctIndexReader.CountReader
counts
The count reader for the current term.protected LongBigList
countsList
A reference to the data for counts, ornull
ofhasCounts
is false.protected long
currentDocument
The current document.protected long
currentTerm
The index of the current term.protected long
frequency
The frequency of the current term.protected boolean
hasCounts
Cached fromindex
.protected boolean
hasPositions
Cached fromindex
.protected QuasiSuccinctIndex
index
The index ofindexReader
, cached.protected QuasiSuccinctIndexReader
indexReader
The index reader associated to this index iterator.protected long
nextPosition
The number of returned positions for the current document.protected long
numberOfDocuments
The number of documents (cached fromindex
).protected long
occurrency
The occurrency of the current term.protected LongBigList
pointersList
A reference to the data for pointers.protected QuasiSuccinctIndexReader.PositionReader
positions
The position reader for the current term.protected LongBigList
positionsList
A reference to the data for positions, ornull
ofhasPositions
is false.-
Fields inherited from class it.unimi.di.big.mg4j.index.AbstractIndexIterator
id, term, weight
-
Fields inherited from interface it.unimi.di.big.mg4j.search.DocumentIterator
END_OF_LIST
-
Fields inherited from interface it.unimi.di.big.mg4j.index.IndexIterator
END_OF_POSITIONS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractQuasiSuccinctIndexIterator(QuasiSuccinctIndexReader indexReader)
-
Method Summary
Modifier and Type Method Description void
dispose()
Disposes this document iterator, releasing all resources.long
document()
Returns the last document returned byDocumentIterator.nextDocument()
.long
frequency()
Returns the frequency, that is, the number of documents that will be returned by this iterator.Index
index()
Returns the index over which this iterator is built.ReferenceSet<Index>
indices()
Returns the set of indices over which this iterator is built.IntervalIterator
intervalIterator()
Returns the interval iterator of this document iterator for single-index queries.IntervalIterator
intervalIterator(Index index)
Returns the interval iterator of this document iterator for the given index.Reference2ReferenceMap<Index,IntervalIterator>
intervalIterators()
Returns an unmodifiable map from indices to interval iterators.int
nextPosition()
Returns the next position at which the term appears in the current document.Payload
payload()
Returns the payload, if any, associated with the current document.long
termNumber()
Returns the number of the term whose inverted list is returned by this index iterator.String
toString()
-
Methods inherited from class it.unimi.di.big.mg4j.index.AbstractIndexIterator
accept, acceptOnTruePaths, id, id, term, term, weight, weight
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unimi.di.big.mg4j.search.DocumentIterator
mayHaveNext, nextDocument, skipTo
-
Methods inherited from interface it.unimi.di.big.mg4j.index.IndexIterator
count
-
-
-
-
Field Detail
-
indexReader
protected final QuasiSuccinctIndexReader indexReader
The index reader associated to this index iterator.
-
index
protected final QuasiSuccinctIndex index
The index ofindexReader
, cached.
-
pointersList
protected final LongBigList pointersList
A reference to the data for pointers.
-
countsList
protected final LongBigList countsList
A reference to the data for counts, ornull
ofhasCounts
is false.
-
positionsList
protected final LongBigList positionsList
A reference to the data for positions, ornull
ofhasPositions
is false.
-
counts
protected QuasiSuccinctIndexReader.CountReader counts
The count reader for the current term.
-
positions
protected QuasiSuccinctIndexReader.PositionReader positions
The position reader for the current term.
-
numberOfDocuments
protected final long numberOfDocuments
The number of documents (cached fromindex
).
-
hasCounts
protected final boolean hasCounts
Cached fromindex
.
-
hasPositions
protected final boolean hasPositions
Cached fromindex
.
-
currentDocument
protected long currentDocument
The current document.
-
frequency
protected long frequency
The frequency of the current term.
-
occurrency
protected long occurrency
The occurrency of the current term.
-
currentTerm
protected long currentTerm
The index of the current term.
-
count
protected long count
The count of the current posting, or -1 if it is not known.
-
nextPosition
protected long nextPosition
The number of returned positions for the current document.
-
-
Constructor Detail
-
AbstractQuasiSuccinctIndexIterator
protected AbstractQuasiSuccinctIndexIterator(QuasiSuccinctIndexReader indexReader)
-
-
Method Detail
-
index
public Index index()
Description copied from interface:IndexIterator
Returns the index over which this iterator is built.- Returns:
- the index over which this iterator is built.
-
termNumber
public long termNumber()
Description copied from interface:IndexIterator
Returns the number of the term whose inverted list is returned by this index iterator.Usually, the term number is automatically set by
IndexReader.documents(CharSequence)
orIndexReader.documents(long)
.- Returns:
- the number of the term over which this iterator is built.
- See Also:
IndexIterator.term()
-
frequency
public long frequency() throws IOException
Description copied from interface:IndexIterator
Returns the frequency, that is, the number of documents that will be returned by this iterator.- Returns:
- the number of documents that will be returned by this iterator.
- Throws:
IOException
-
payload
public Payload payload() throws IOException
Description copied from interface:IndexIterator
Returns the payload, if any, associated with the current document.- Returns:
- the payload associated with the current document.
- Throws:
IOException
-
nextPosition
public int nextPosition() throws IOException
Description copied from interface:IndexIterator
Returns the next position at which the term appears in the current document.- Returns:
- the next position of the current document in which the current term appears,
or
IndexIterator.END_OF_POSITIONS
if there are no more positions. - Throws:
IOException
-
document
public long document()
Description copied from interface:DocumentIterator
Returns the last document returned byDocumentIterator.nextDocument()
.- Returns:
- the last document returned by
DocumentIterator.nextDocument()
, -1 if no document has been returned yet, andDocumentIterator.END_OF_LIST
if the list of results has been exhausted.
-
intervalIterators
public Reference2ReferenceMap<Index,IntervalIterator> intervalIterators() throws IOException
Description copied from interface:DocumentIterator
Returns an unmodifiable map from indices to interval iterators.After a call to
DocumentIterator.nextDocument()
, this map can be used to retrieve the intervals in the current document. An invocation ofMap.get(java.lang.Object)
on this map with argumentindex
yields the same result asintervalIterator(index)
.- Returns:
- a map from indices to interval iterators over the current document.
- Throws:
IOException
- See Also:
DocumentIterator.intervalIterator(Index)
-
intervalIterator
public IntervalIterator intervalIterator() throws IOException
Description copied from interface:DocumentIterator
Returns the interval iterator of this document iterator for single-index queries.This is a commodity method that can be used only for queries built over a single index.
- Returns:
- an interval iterator.
- Throws:
IOException
- See Also:
DocumentIterator.intervalIterator(Index)
-
intervalIterator
public IntervalIterator intervalIterator(Index index) throws IOException
Description copied from interface:DocumentIterator
Returns the interval iterator of this document iterator for the given index.After a call to
DocumentIterator.nextDocument()
, this iterator can be used to retrieve the intervals in the current document (the one returned byDocumentIterator.nextDocument()
) for the indexindex
.Note that if all indices have positions, it is guaranteed that at least one index will return an interval. However, for disjunctive queries it cannot be guaranteed that all indices will return an interval.
Indices without positions always return
IntervalIterators.TRUE
. Thus, in presence of indices without positions it is possible that no intervals at all are available.- Parameters:
index
- an index (must be one over which the query was built).- Returns:
- an interval iterator over the current document in
index
. - Throws:
IOException
-
indices
public ReferenceSet<Index> indices()
Description copied from interface:DocumentIterator
Returns the set of indices over which this iterator is built.- Returns:
- the set of indices over which this iterator is built.
-
dispose
public void dispose() throws IOException
Description copied from interface:DocumentIterator
Disposes this document iterator, releasing all resources.This method should propagate down to the underlying index iterators, where it should release resources such as open files and network connections. If you're doing your own resource tracking and pooling, then you do not need to call this method.
- Throws:
IOException
-
-