Class CollectionFindAndRerankCursor<T,R>
java.lang.Object
com.datastax.astra.internal.command.AbstractCursor<T,RerankedResult<R>>
com.datastax.astra.client.collections.commands.cursor.CollectionFindAndRerankCursor<T,R>
- Type Parameters:
T- working document objectR- working object for results, should be same as DOC if no projections
- All Implemented Interfaces:
Cloneable,Iterable<RerankedResult<R>>
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
ConstructorsConstructorDescriptionCollectionFindAndRerankCursor(Collection<T> dataSource, Filter filter, CollectionFindAndRerankOptions options, Class<R> recordType) Cursor to iterate on the result of a query. -
Method Summary
Modifier and TypeMethodDescriptionclone()void{PageState is always null, all is returned here }Immutable methods that return a new Cursor instance.Retrieve keyspace name.Creates a newCollectionFindAndRerankCursorthat includes similarity scores in the results.Creates a newCollectionFindAndRerankCursorthat includes sort vector metadata in the results.limit(int newLimit) Creates a newCollectionFindAndRerankCursorwith a specified limit on the number of results.project(Projection... newProjection) Creates a newCollectionFindAndRerankCursorwith an updated projection.Creates a newCollectionFindAndRerankCursorwith 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
-
CollectionFindAndRerankCursor
public CollectionFindAndRerankCursor(Collection<T> dataSource, Filter filter, CollectionFindAndRerankOptions options, Class<R> recordType) Cursor to iterate on the result of a query.- Parameters:
dataSource- source collectionfilter- current filteroptions- options of the find operationrecordType- the type of the record
-
-
Method Details
-
clone
-
filter
Immutable methods that return a new Cursor instance.- Parameters:
newFilter- a new filter- Returns:
- a new cursor
-
project
Creates a newCollectionFindAndRerankCursorwith an updated projection.- Parameters:
newProjection- the new projection to apply- Returns:
- a new
CollectionFindAndRerankCursorinstance with the specified projection
-
sort
Creates a newCollectionFindAndRerankCursorwith a specified sort order.- Parameters:
sort- the sort criteria to apply- Returns:
- a new
CollectionFindAndRerankCursorinstance with the specified sort order
-
limit
Creates a newCollectionFindAndRerankCursorwith a specified limit on the number of results.- Parameters:
newLimit- the maximum number of results to retrieve- Returns:
- a new
CollectionFindAndRerankCursorinstance with the specified limit
-
includeSimilarity
Creates a newCollectionFindAndRerankCursorthat includes similarity scores in the results.- Returns:
- a new
CollectionFindAndRerankCursorinstance with similarity scores included
-
includeSortVector
Creates a newCollectionFindAndRerankCursorthat includes sort vector metadata in the results.- Returns:
- a new
CollectionFindAndRerankCursorinstance with sort vector metadata included
-
fetchNextBatch
public void fetchNextBatch(){PageState is always null, all is returned here }- Specified by:
fetchNextBatchin classAbstractCursor<T,RerankedResult<R>>
-
getKeyspace
Retrieve keyspace name.- Returns:
- keyspace name
-