|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.unimi.di.mg4j.search.AbstractDocumentIterator it.unimi.di.mg4j.index.cluster.DocumentalMergedClusterDocumentIterator it.unimi.di.mg4j.index.cluster.DocumentalMergedClusterIndexIterator
public class DocumentalMergedClusterIndexIterator
An index iterator merging iterators from local indices.
Field Summary | |
---|---|
protected int |
frequency
The precomputed frequency. |
protected int |
id
The id associated with this index iterator. |
protected DocumentalMergedCluster |
index
The reference index. |
protected IndexIterator[] |
indexIterator
A cached copy of the iterators, to avoid type casts. |
protected String |
term
The term associated with this index iterator. |
Fields inherited from class it.unimi.di.mg4j.index.cluster.DocumentalMergedClusterDocumentIterator |
---|
currentIterator, documentIterator, globalDocumentPointer, indices, n, queue, strategy, usedIndex |
Fields inherited from class it.unimi.di.mg4j.search.AbstractDocumentIterator |
---|
curr, weight |
Fields inherited from interface it.unimi.di.mg4j.index.IndexIterator |
---|
END_OF_POSITIONS |
Fields inherited from interface it.unimi.di.mg4j.search.DocumentIterator |
---|
END_OF_LIST |
Constructor Summary | |
---|---|
DocumentalMergedClusterIndexIterator(DocumentalClusterIndexReader indexReader,
IndexIterator[] indexIterator,
int[] usedIndex)
|
Method Summary | ||
---|---|---|
|
accept(DocumentIteratorVisitor<T> visitor)
Accepts a visitor. |
|
|
acceptOnTruePaths(DocumentIteratorVisitor<T> visitor)
Accepts a visitor after a call to DocumentIterator.nextDocument() ,
limiting recursion to true paths. |
|
int |
count()
Returns the count, that is, the number of occurrences of the term in the current document. |
|
int |
frequency()
Returns the frequency, that is, the number of documents that will be returned by this iterator. |
|
int |
id()
Returns the id of this index iterator. |
|
DocumentalMergedClusterIndexIterator |
id(int id)
Sets the id of this index iterator. |
|
Index |
index()
Returns the index over which this iterator is built. |
|
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. |
|
String |
term()
Returns the term whose inverted list is returned by this index iterator. |
|
DocumentalMergedClusterIndexIterator |
term(CharSequence term)
Sets the term whose inverted list is returned by this index iterator. |
|
int |
termNumber()
Returns the number of the term whose inverted list is returned by this index iterator. |
|
IndexIterator |
weight(double weight)
Sets the weight of this index iterator. |
Methods inherited from class it.unimi.di.mg4j.index.cluster.DocumentalMergedClusterDocumentIterator |
---|
dispose, indices, intervalIterator, intervalIterator, intervalIterators, nextDocument, skipTo |
Methods inherited from class it.unimi.di.mg4j.search.AbstractDocumentIterator |
---|
document, ensureOnADocument, mayHaveNext, weight |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface it.unimi.di.mg4j.search.DocumentIterator |
---|
dispose, document, indices, intervalIterator, intervalIterator, intervalIterators, mayHaveNext, nextDocument, skipTo, weight |
Field Detail |
---|
protected final IndexIterator[] indexIterator
protected final int frequency
protected final DocumentalMergedCluster index
protected String term
protected int id
Constructor Detail |
---|
public DocumentalMergedClusterIndexIterator(DocumentalClusterIndexReader indexReader, IndexIterator[] indexIterator, int[] usedIndex) throws IOException
IOException
Method Detail |
---|
public DocumentalMergedClusterIndexIterator term(CharSequence term)
IndexIterator
Usually, the term is automatically set by Index.documents(CharSequence)
or by IndexReader.documents(CharSequence)
, but you can
use this method to ensure that IndexIterator.term()
doesn't throw
an exception.
term
in interface IndexIterator
term
- a character sequence (that will be defensively copied)
that will be assumed to be the term whose inverted list is returned by this index iterator.
public String term()
IndexIterator
Usually, the term is automatically set by IndexReader.documents(CharSequence)
or IndexReader.documents(int)
, but you can
supply your own term with IndexIterator.term(CharSequence)
.
term
in interface IndexIterator
IndexIterator.termNumber()
public DocumentalMergedClusterIndexIterator id(int id)
IndexIterator
The id is an integer associated with each index iterator. It has no specific semantics, and can be used differently in different contexts. A typical usage pattern, for instance, is using it to assign a unique number to the index iterators contained in a composite document iterator (say, numbering consecutively the leaves of the composite).
id
in interface IndexIterator
id
- the new id for this index iterator.
public int id()
IndexIterator
id
in interface IndexIterator
IndexIterator.id(int)
public Index index()
IndexIterator
index
in interface IndexIterator
public int frequency()
IndexIterator
frequency
in interface IndexIterator
public Payload payload() throws IOException
IndexIterator
payload
in interface IndexIterator
IOException
public int count() throws IOException
IndexIterator
count
in interface IndexIterator
IOException
public int nextPosition() throws IOException
IndexIterator
nextPosition
in interface IndexIterator
IndexIterator.END_OF_POSITIONS
if there are no more positions.
IOException
public <T> T accept(DocumentIteratorVisitor<T> visitor) throws IOException
DocumentIterator
A document iterator is usually structured as composite,
with operators as internal nodes and IndexIterator
s
as leaves. This method implements the visitor pattern.
accept
in interface DocumentIterator
accept
in class DocumentalMergedClusterDocumentIterator
visitor
- the visitor.
null
if the visit was interrupted.
IOException
public <T> T acceptOnTruePaths(DocumentIteratorVisitor<T> visitor) throws IOException
DocumentIterator
DocumentIterator.nextDocument()
,
limiting recursion to true paths.
After a call to DocumentIterator.nextDocument()
, a document iterator
is positioned over a document. This call is equivalent to DocumentIterator.accept(DocumentIteratorVisitor)
,
but visits only along true paths.
We define a true path as a path from the root of the composite that passes only through
nodes whose associated subtree is positioned on the same document of the root. Note that OrDocumentIterator
s
detach exhausted iterators from the composite tree, so true paths define the subtree that is causing
the current document to satisfy the query represented by this document iterator.
For more elaboration, and the main application of this method, see CounterCollectionVisitor
.
acceptOnTruePaths
in interface DocumentIterator
acceptOnTruePaths
in class DocumentalMergedClusterDocumentIterator
visitor
- the visitor.
null
if the visit was interrupted.
IOException
DocumentIterator.accept(DocumentIteratorVisitor)
,
CounterCollectionVisitor
public int termNumber()
IndexIterator
Usually, the term number is automatically set by IndexReader.documents(CharSequence)
or IndexReader.documents(int)
.
termNumber
in interface IndexIterator
IndexIterator.term()
public IndexIterator weight(double weight)
DocumentIterator
weight
in interface IndexIterator
weight
in interface DocumentIterator
weight
in class AbstractDocumentIterator
weight
- the weight of this index iterator.
DocumentIterator.weight(double)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |