org.neo4j.index.impl.lucene
Class CombinedIndexHits<T>

java.lang.Object
  extended by org.neo4j.helpers.collection.PrefetchingIterator<T>
      extended by org.neo4j.helpers.collection.CombiningIterator<T>
          extended by org.neo4j.index.impl.lucene.CombinedIndexHits<T>
All Implemented Interfaces:
Iterable<T>, Iterator<T>, IndexHits<T>

public class CombinedIndexHits<T>
extends CombiningIterator<T>
implements IndexHits<T>


Constructor Summary
CombinedIndexHits(Collection<IndexHits<T>> iterators)
           
 
Method Summary
 void close()
          Closes the underlying search result.
protected  IndexHits<T> currentIterator()
           
 float currentScore()
          Returns the score of the most recently fetched item from this iterator (from Iterator.next()).
 T getSingle()
          Returns the first and only item from the result iterator, or null if there was none.
 Iterator<T> iterator()
           
 int size()
          Returns the size of this iterable, in most scenarios this value is accurate while in some scenarios near-accurate.
 
Methods inherited from class org.neo4j.helpers.collection.CombiningIterator
fetchNextOrNull
 
Methods inherited from class org.neo4j.helpers.collection.PrefetchingIterator
getPrefetchedNextOrNull, hasNext, next, remove, setPrefetchedNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

CombinedIndexHits

public CombinedIndexHits(Collection<IndexHits<T>> iterators)
Method Detail

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

currentIterator

protected IndexHits<T> currentIterator()
Overrides:
currentIterator in class CombiningIterator<T>

size

public int size()
Description copied from interface: IndexHits
Returns the size of this iterable, in most scenarios this value is accurate while in some scenarios near-accurate. There's no cost in calling this method. It's considered near-accurate if this IndexHits object has been returned when inside a Transaction which has index modifications, of a certain nature. Also entities (Nodes/Relationships) which have been deleted from the graph, but are still in the index will also affect the accuracy of the returned size.

Specified by:
size in interface IndexHits<T>
Returns:
the near-accurate size if this iterable.

close

public void close()
Description copied from interface: IndexHits
Closes the underlying search result. This method should be called whenever you've got what you wanted from the result and won't use it anymore. It's necessary to call it so that underlying indexes can dispose of allocated resources for this search result. You can however skip to call this method if you loop through the whole result, then close() will be called automatically. Even if you loop through the entire result and then call this method it will silently ignore any consequtive call (for convenience).

Specified by:
close in interface IndexHits<T>

getSingle

public T getSingle()
Description copied from interface: IndexHits
Returns the first and only item from the result iterator, or null if there was none. If there were more than one item in the result a NoSuchElementException will be thrown. This method must be called first in the iteration and will grab the first item from the iteration, so the result is considered broken after this call.

Specified by:
getSingle in interface IndexHits<T>
Returns:
the first and only item, or null if none.

currentScore

public float currentScore()
Description copied from interface: IndexHits
Returns the score of the most recently fetched item from this iterator (from Iterator.next()). The range of the returned values is up to the Index implementation to dictate.

Specified by:
currentScore in interface IndexHits<T>
Returns:
the score of the most recently fetched item from this iterator.


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.