Provides access to an inverted index.
An
it.unimi.dsi.mg4j.index.Index contains global read-only metadata. To get actual data
from an index, you need to get an index reader via a call to
Index.getReader . Once
you have an index reader, you can ask for the
.
Alternatively, you can perform a read-once scan of the index calling
IndexReader.nextIterator() ,
which will return in order the
of all terms of the underlying index.
More generally,
IndexReader.nextIterator() returns an iterator positioned at the start of the inverted
list of the term after the current one. When called just after the reader creation, it returns an
index iterator for the first term.
Warning: An index reader is exactly what it looks like—a reader. It
cannot be used by many threads at the same time, and all its access methods are exclusive: if you
obtain a
, the previous one is no longer valid. However,
you can generate many readers, and use them concurrently.
Warning: Invoking the
it.unimi.dsi.mg4j.search.DocumentIterator.dispose method
on iterators returned by an instance of this class will invoke
IndexReader.close() on the instance, thus
making the instance no longer accessible. This behaviour is necessary to handle cases in which a
reader is created on-the-fly just to create an iterator.
Warning: As of MG4J 1.2, direct (i.e., bit-level) access to an inverted index is no longer possible.
author: Paolo Boldi author: Sebastiano Vigna since: 1.0 |