Skip to content

Commit d91d707

Browse files
committed
FindAndRerank
1 parent 856867a commit d91d707

File tree

56 files changed

+4270
-363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4270
-363
lines changed

astra-db-java/src/main/java/com/datastax/astra/client/collections/Collection.java

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import com.datastax.astra.client.collections.commands.results.FindOneAndReplaceResult;
4949
import com.datastax.astra.client.core.options.BaseOptions;
5050
import com.datastax.astra.client.core.commands.Command;
51-
import com.datastax.astra.client.collections.commands.cursor.CollectionCursor;
51+
import com.datastax.astra.client.collections.commands.cursor.CollectionFindCursor;
5252
import com.datastax.astra.client.core.paging.Page;
5353
import com.datastax.astra.client.core.query.Filter;
5454
import com.datastax.astra.client.core.query.Filters;
@@ -994,8 +994,8 @@ public Optional<T> findById(Object id) {
994994
* @return
995995
* the find iterable interface
996996
*/
997-
public CollectionCursor<T, T> find(Filter filter, CollectionFindOptions options) {
998-
return new CollectionCursor<>(this, filter, options, getDocumentClass());
997+
public CollectionFindCursor<T, T> find(Filter filter, CollectionFindOptions options) {
998+
return new CollectionFindCursor<>(this, filter, options, getDocumentClass());
999999
}
10001000

10011001
/**
@@ -1010,8 +1010,8 @@ public CollectionCursor<T, T> find(Filter filter, CollectionFindOptions options)
10101010
* @return
10111011
* the find iterable interface
10121012
*/
1013-
public <R> CollectionCursor<T, R> find(Filter filter, CollectionFindOptions options, Class<R> newDocType) {
1014-
return new CollectionCursor<>(this, filter, options, newDocType);
1013+
public <R> CollectionFindCursor<T, R> find(Filter filter, CollectionFindOptions options, Class<R> newDocType) {
1014+
return new CollectionFindCursor<>(this, filter, options, newDocType);
10151015
}
10161016

10171017
/**
@@ -1022,8 +1022,8 @@ public <R> CollectionCursor<T, R> find(Filter filter, CollectionFindOptions opti
10221022
* @return
10231023
* the find iterable interface
10241024
*/
1025-
public CollectionCursor<T, T> find(Filter filter) {
1026-
return new CollectionCursor<>(this, filter, new CollectionFindOptions(), getDocumentClass());
1025+
public CollectionFindCursor<T, T> find(Filter filter) {
1026+
return new CollectionFindCursor<>(this, filter, new CollectionFindOptions(), getDocumentClass());
10271027
}
10281028

10291029
/**
@@ -1034,8 +1034,8 @@ public CollectionCursor<T, T> find(Filter filter) {
10341034
* @return
10351035
* the find iterable interface
10361036
*/
1037-
public CollectionCursor<T, T> find(CollectionFindOptions options) {
1038-
return new CollectionCursor<>(this, null, options, getDocumentClass());
1037+
public CollectionFindCursor<T, T> find(CollectionFindOptions options) {
1038+
return new CollectionFindCursor<>(this, null, options, getDocumentClass());
10391039
}
10401040

10411041
/**
@@ -1045,9 +1045,9 @@ public CollectionCursor<T, T> find(CollectionFindOptions options) {
10451045
* without applying any filters. It leverages the default {@link CollectionFindOptions} for query execution.
10461046
* </p>
10471047
*
1048-
* @return A {@link CollectionCursor} for iterating over all documents in the collection.
1048+
* @return A {@link CollectionFindCursor} for iterating over all documents in the collection.
10491049
*/
1050-
public CollectionCursor<T, T> findAll() {
1050+
public CollectionFindCursor<T, T> findAll() {
10511051
return find(null, new CollectionFindOptions());
10521052
}
10531053

@@ -1129,6 +1129,24 @@ public CompletableFuture<Page<T>> findPageASync(Filter filter, CollectionFindOpt
11291129
return CompletableFuture.supplyAsync(() -> findPage(filter, options));
11301130
}
11311131

1132+
// -----------------------------
1133+
// --- Find and Rerank ----
1134+
// -----------------------------
1135+
1136+
/**
1137+
* Finds all documents in the collection.
1138+
*
1139+
* @param filter
1140+
* the query filter
1141+
* @param options
1142+
* options of find one
1143+
* @return
1144+
* the find iterable interface
1145+
*/
1146+
public CollectionFindCursor<T, T> findAndRerank(Filter filter, CollectionFindOptions options) {
1147+
return new CollectionFindCursor<>(this, filter, options, getDocumentClass());
1148+
}
1149+
11321150
// -------------------------
11331151
// --- distinct ----
11341152
// -------------------------

0 commit comments

Comments
 (0)