Class CollectionFindCursor<T,R>
java.lang.Object
com.datastax.astra.internal.command.AbstractCursor<T,R>
com.datastax.astra.client.collections.commands.cursor.CollectionFindCursor<T,R>
- Type Parameters:
T- working document objectR- working object for results, should be same as DOC if no projections
Implementation of a cursor across the find items
-
Field Summary
Fields inherited from class com.datastax.astra.internal.command.AbstractCursor
buffer, consumed, currentPage, recordType, state -
Constructor Summary
ConstructorsConstructorDescriptionCollectionFindCursor(Collection<T> dataSource, Filter filter, CollectionFindOptions options, Class<R> documentType) Cursor to iterate on the result of a query. -
Method Summary
Modifier and TypeMethodDescriptionclone()voidFetches the next batch of documents into the buffer.Immutable methods that return a new Cursor instance.Retrieve keyspace name.Creates a newCollectionFindCursorthat includes similarity scores in the results.Creates a newCollectionFindCursorthat includes sort vector metadata in the results.limit(int newLimit) Creates a newCollectionFindCursorwith a specified limit on the number of results.project(Projection... newProjection) Creates a newCollectionFindCursorwith an updated projection.skip(int newSkip) Creates a newCollectionFindCursorthat skips a specified number of results.Creates a newCollectionFindCursorwith a specified sort order.Methods inherited from class com.datastax.astra.internal.command.AbstractCursor
checkIdleState, close, consumeBuffer, getBufferedSize, getSortVector, hasNext, iterator, next, rewind, stream, toListMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CollectionFindCursor
public CollectionFindCursor(Collection<T> dataSource, Filter filter, CollectionFindOptions options, Class<R> documentType) Cursor to iterate on the result of a query.- Parameters:
dataSource- source collectionfilter- current filteroptions- options of the find operationdocumentType- row type returned with the cursor
-
-
Method Details
-
clone
-
filter
Immutable methods that return a new Cursor instance.- Parameters:
newFilter- a new filter- Returns:
- a new cursor
-
project
Creates a newCollectionFindCursorwith an updated projection.- Parameters:
newProjection- the new projection to apply- Returns:
- a new
CollectionFindCursorinstance with the specified projection
-
sort
Creates a newCollectionFindCursorwith a specified sort order.- Parameters:
sort- the sort criteria to apply- Returns:
- a new
CollectionFindCursorinstance with the specified sort order
-
limit
Creates a newCollectionFindCursorwith a specified limit on the number of results.- Parameters:
newLimit- the maximum number of results to retrieve- Returns:
- a new
CollectionFindCursorinstance with the specified limit
-
skip
Creates a newCollectionFindCursorthat skips a specified number of results.- Parameters:
newSkip- the number of results to skip- Returns:
- a new
CollectionFindCursorinstance with the specified skip value
-
includeSimilarity
Creates a newCollectionFindCursorthat includes similarity scores in the results.- Returns:
- a new
CollectionFindCursorinstance with similarity scores included
-
includeSortVector
Creates a newCollectionFindCursorthat includes sort vector metadata in the results.- Returns:
- a new
CollectionFindCursorinstance with sort vector metadata included
-
fetchNextBatch
public void fetchNextBatch()Fetches the next batch of documents into the buffer. This method handles paging, using the page state from the previous batch to fetch the next one.- Specified by:
fetchNextBatchin classAbstractCursor<T,R>
-
getKeyspace
Retrieve keyspace name.- Returns:
- keyspace name
-