T
- the type of items in the Iterator.@Deprecated public interface IndexHits<T> extends org.neo4j.graphdb.ResourceIterator<T>, org.neo4j.graphdb.ResourceIterable<T>
Iterator
with additional size()
and close()
methods on it, used for iterating over index query results. It is first and
foremost an Iterator
, but also an Iterable
JUST so that it
can be used in a for-each loop. The iterator()
method
always returns this
.
The size is calculated before-hand so that calling it is always fast.
When you're done with the result and haven't reached the end of the
iteration close()
must be called. Results which are looped through
entirely closes automatically. Typical use:
IndexHits<Node> hits = index.get( "key", "value" );
try
{
for ( Node node : hits )
{
// do something with the hit
}
}
finally
{
hits.close();
}
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
|
float |
currentScore()
Deprecated.
|
T |
getSingle()
Deprecated.
|
int |
size()
Deprecated.
|
default Stream<T> |
stream()
Deprecated.
|
forEachRemaining, hasNext, next, remove
forEach, spliterator
@Deprecated int size()
IndexHits
object has been returned when inside a Transaction
which has index modifications, of a certain nature. Also entities
(Node
s/Relationship
s) which have been deleted from the graph,
but are still in the index will also affect the accuracy of the returned size.@Deprecated void close()
close
in interface AutoCloseable
close
in interface org.neo4j.graphdb.Resource
close
in interface org.neo4j.graphdb.ResourceIterator<T>
@Deprecated default Stream<T> stream()
@Deprecated T getSingle()
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.null
if none.@Deprecated float currentScore()
Iterator.next()
). The range of the returned values is up to the
Index
implementation to dictate.Copyright © 2002–2018 The Neo4j Graph Database Project. All rights reserved.