|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectit.unimi.di.mg4j.index.AbstractIndexIterator
public abstract class AbstractIndexIterator
A very basic abstract implementation of an index iterator,
providing an obvious implementation of IndexIterator.term(), IndexIterator.id(), DocumentIterator.weight()
and of the visiting methods.
| Field Summary | |
|---|---|
protected int |
id
The identifier associated with this index iterator. |
protected String |
term
The term associated with this index iterator. |
protected double |
weight
The weight associated with this index iterator. |
| 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 | |
|---|---|
AbstractIndexIterator()
|
|
| 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 |
id()
Returns the id of this index iterator. |
|
IndexIterator |
id(int id)
Sets the id of this index iterator. |
|
String |
term()
Returns the term whose inverted list is returned by this index iterator. |
|
IndexIterator |
term(CharSequence term)
Sets the term whose inverted list is returned by this index iterator. |
|
double |
weight()
Returns the weight associated with this iterator. |
|
IndexIterator |
weight(double weight)
Returns the weight of this index iterator. |
|
| 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.index.IndexIterator |
|---|
count, frequency, index, nextPosition, payload, termNumber |
| Methods inherited from interface it.unimi.di.mg4j.search.DocumentIterator |
|---|
dispose, document, indices, intervalIterator, intervalIterator, intervalIterators, mayHaveNext, nextDocument, skipTo |
| Field Detail |
|---|
protected String term
protected int id
protected double weight
| Constructor Detail |
|---|
public AbstractIndexIterator()
| Method Detail |
|---|
public String term()
IndexIteratorUsually, 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 IndexIteratorIndexIterator.termNumber()public IndexIterator term(CharSequence term)
IndexIteratorUsually, 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 IndexIteratorterm - 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 int id()
IndexIterator
id in interface IndexIteratorIndexIterator.id(int)public IndexIterator id(int id)
IndexIteratorThe 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 IndexIteratorid - the new id for this index iterator.
public double weight()
DocumentIteratorThe number returned by this method has no fixed semantics: different scorers might choose different interpretations, or even ignore it.
weight in interface DocumentIteratorpublic IndexIterator weight(double weight)
IndexIterator
weight in interface IndexIteratorweight in interface DocumentIteratorweight - the weight of this index iterator.
DocumentIterator.weight(double)
public <T> T accept(DocumentIteratorVisitor<T> visitor)
throws IOException
DocumentIteratorA document iterator is usually structured as composite,
with operators as internal nodes and IndexIterators
as leaves. This method implements the visitor pattern.
accept in interface DocumentIteratorvisitor - the visitor.
null if the visit was interrupted.
IOException
public <T> T acceptOnTruePaths(DocumentIteratorVisitor<T> visitor)
throws IOException
DocumentIteratorDocumentIterator.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 OrDocumentIterators
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 DocumentIteratorvisitor - the visitor.
null if the visit was interrupted.
IOExceptionDocumentIterator.accept(DocumentIteratorVisitor),
CounterCollectionVisitor
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||