From 009ee89f8b178ddb6c5c68b29757edac6302578f Mon Sep 17 00:00:00 2001 From: Anush008 Date: Thu, 20 Jun 2024 14:58:53 +0530 Subject: [PATCH] test: scrollWithOrdering --- gradle.properties | 4 +- .../java/io/qdrant/client/PointsTest.java | 44 ++++++++++++------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/gradle.properties b/gradle.properties index 047ef1f..8db2040 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ # The version of qdrant to use to download protos -qdrantProtosVersion=v1.9.2 +qdrantProtosVersion=v1.9.5 # The version of qdrant docker image to run integration tests against -qdrantVersion=v1.9.2 +qdrantVersion=v1.9.5 # The version of the client to generate packageVersion=1.9.1 diff --git a/src/test/java/io/qdrant/client/PointsTest.java b/src/test/java/io/qdrant/client/PointsTest.java index a549a2a..ecf0845 100644 --- a/src/test/java/io/qdrant/client/PointsTest.java +++ b/src/test/java/io/qdrant/client/PointsTest.java @@ -363,22 +363,6 @@ public void searchGroups() throws ExecutionException, InterruptedException { public void scroll() throws ExecutionException, InterruptedException { createAndSeedCollection(testName); - Collections.PayloadIndexParams params = Collections.PayloadIndexParams.newBuilder() - .setIntegerIndexParams( - Collections.IntegerIndexParams.newBuilder().setLookup(false).setRange(true).build()) - .build(); - - UpdateResult resultIndex = client.createPayloadIndexAsync( - testName, - "bar", - PayloadSchemaType.Integer, - params, - true, - null, - null).get(); - - assertEquals(UpdateStatus.Completed, resultIndex.getStatus()); - ScrollResponse scrollResponse = client.scrollAsync(ScrollPoints.newBuilder() .setCollectionName(testName) .setLimit(1) @@ -397,8 +381,32 @@ public void scroll() throws ExecutionException, InterruptedException { assertEquals(1, scrollResponse.getResultCount()); assertFalse(scrollResponse.hasNextPageOffset()); + } - scrollResponse = client.scrollAsync(ScrollPoints.newBuilder() + @Test + public void scrollWithOrdering() throws ExecutionException, InterruptedException { + createAndSeedCollection(testName); + + Collections.PayloadIndexParams params = Collections.PayloadIndexParams.newBuilder() + .setIntegerIndexParams( + Collections.IntegerIndexParams.newBuilder().setLookup(false).setRange(true).build()) + .build(); + + UpdateResult resultIndex = client.createPayloadIndexAsync( + testName, + "bar", + PayloadSchemaType.Integer, + params, + true, + null, + null).get(); + + assertEquals(UpdateStatus.Completed, resultIndex.getStatus()); + + CollectionInfo collectionInfo = client.getCollectionInfoAsync(testName).get(); + assertEquals(ImmutableSet.of("bar"), collectionInfo.getPayloadSchemaMap().keySet()); + + ScrollResponse scrollResponse = client.scrollAsync(ScrollPoints.newBuilder() .setCollectionName(testName) .setLimit(1) .setOrderBy(Points.OrderBy.newBuilder() @@ -407,8 +415,10 @@ public void scroll() throws ExecutionException, InterruptedException { .build() ).get(); + assertEquals(1, scrollResponse.getResultCount()); assertFalse(scrollResponse.hasNextPageOffset()); + assertEquals(scrollResponse.getResult(0).getId(), id(9)); } @Test