Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ To install the library, add the following lines to your build config file.
<dependency>
<groupId>io.qdrant</groupId>
<artifactId>client</artifactId>
<version>1.19.0</version>
<version>1.20.0</version>
</dependency>
```

#### SBT

```sbt
libraryDependencies += "io.qdrant" % "client" % "1.19.0"
libraryDependencies += "io.qdrant" % "client" % "1.20.0"
```

#### Gradle

```gradle
implementation 'io.qdrant:client:1.19.0'
implementation 'io.qdrant:client:1.20.0'
```

> [!NOTE]
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ tasks.register('downloadProtos') {
def fileName = Paths.get(entry.getName()).getFileName().toString()
def dest = java.nio.file.Path.of(outputDirectory, fileName)
logger.debug("writing {} to {}", fileName, dest)
Files.write(dest, lines, StandardOpenOption.CREATE)
Files.write(dest, lines, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ repositories {

dependencies {
// Qdrant Java client
implementation 'io.qdrant:client:1.19.0'
implementation 'io.qdrant:client:1.20.0'

// gRPC dependencies - use the same version as Qdrant client
implementation 'io.grpc:grpc-netty-shaded:1.65.1'
implementation 'io.grpc:grpc-protobuf:1.65.1'
implementation 'io.grpc:grpc-stub:1.65.1'
implementation 'io.grpc:grpc-services:1.65.1'
implementation 'io.grpc:grpc-netty-shaded:1.84.2'
implementation 'io.grpc:grpc-protobuf:1.84.2'
implementation 'io.grpc:grpc-stub:1.84.2'
implementation 'io.grpc:grpc-services:1.84.2'

// Protobuf runtime
implementation 'com.google.protobuf:protobuf-java:3.25.4'
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# The version of qdrant to use to download protos
qdrantProtosVersion=v1.19.0
qdrantProtosVersion=v1.20.0

# The version of qdrant docker image to run integration tests against
qdrantVersion=v1.19.0
qdrantVersion=v1.20.0

# The version of the client to generate
packageVersion=1.19.0
packageVersion=1.20.0
17 changes: 17 additions & 0 deletions src/main/java/io/qdrant/client/ConditionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,23 @@ public static Condition matchPrefix(String field, String prefix) {
.build();
}

/**
* Match records where the given field contains the given substring.
*
* @param field The name of the field
* @param substring The substring to match
* @return a new instance of {@link Condition}
*/
public static Condition matchSubstring(String field, String substring) {
return Condition.newBuilder()
.setField(
FieldCondition.newBuilder()
.setKey(field)
.setMatch(Match.newBuilder().setSubstring(substring).build())
.build())
.build();
}

/**
* Match records where the given field matches the given boolean value.
*
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/io/qdrant/client/ExpressionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import io.qdrant.client.grpc.Points.DivExpression;
import io.qdrant.client.grpc.Points.Expression;
import io.qdrant.client.grpc.Points.GeoDistance;
import io.qdrant.client.grpc.Points.MaxExpression;
import io.qdrant.client.grpc.Points.MinExpression;
import io.qdrant.client.grpc.Points.MultExpression;
import io.qdrant.client.grpc.Points.PowExpression;
import io.qdrant.client.grpc.Points.SumExpression;
Expand Down Expand Up @@ -202,4 +204,34 @@ public static Expression gaussDecay(DecayParamsExpression decay) {
public static Expression linDecay(DecayParamsExpression decay) {
return Expression.newBuilder().setLinDecay(decay).build();
}

/**
* Creates an {@link Expression} representing inverse hyperbolic cosine.
*
* @param expr The expression to apply acosh() to
* @return a new instance of {@link Expression}
*/
public static Expression acosh(Expression expr) {
return Expression.newBuilder().setAcosh(expr).build();
}

/**
* Creates an {@link Expression} for the maximum of values.
*
* @param max The maximum expression
* @return a new instance of {@link Expression}
*/
public static Expression max(MaxExpression max) {
return Expression.newBuilder().setMax(max).build();
}

/**
* Creates an {@link Expression} for the minimum of values.
*
* @param min The minimum expression
* @return a new instance of {@link Expression}
*/
public static Expression min(MinExpression min) {
return Expression.newBuilder().setMin(min).build();
}
}
21 changes: 21 additions & 0 deletions src/main/java/io/qdrant/client/QueryFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.qdrant.client.grpc.Points.RelevanceFeedbackInput;
import io.qdrant.client.grpc.Points.Rrf;
import io.qdrant.client.grpc.Points.Sample;
import io.qdrant.client.grpc.Points.TextQuery;
import io.qdrant.client.grpc.Points.VectorInput;
import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -108,6 +109,26 @@ public static Query formula(Formula formula) {
return Query.newBuilder().setFormula(formula).build();
}

/**
* Creates a {@link Query} for BM25 text search.
*
* @param query The text to search for
* @return a new instance of {@link Query}
*/
public static Query text(String query) {
return text(TextQuery.newBuilder().setQuery(query).build());
}

/**
* Creates a {@link Query} for BM25 text search.
*
* @param text An instance of {@link TextQuery}
* @return a new instance of {@link Query}
*/
public static Query text(TextQuery text) {
return Query.newBuilder().setText(text).build();
}

// region Nearest search queries

/**
Expand Down
25 changes: 25 additions & 0 deletions src/test/java/io/qdrant/client/CollectionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import io.qdrant.client.grpc.Collections.CollectionStatus;
import io.qdrant.client.grpc.Collections.CreateCollection;
import io.qdrant.client.grpc.Collections.Distance;
import io.qdrant.client.grpc.Collections.IdTrackerParams;
import io.qdrant.client.grpc.Collections.Memory;
import io.qdrant.client.grpc.Collections.VectorParams;
import io.qdrant.client.grpc.Collections.VectorsConfig;
import io.qdrant.client.grpc.Points.CreateVectorNameRequest;
Expand Down Expand Up @@ -140,6 +142,29 @@ public void updateCollection() throws ExecutionException, InterruptedException {
.get();
}

@Test
public void createCollection_with_id_tracker() throws ExecutionException, InterruptedException {
client
.createCollectionAsync(
CreateCollection.newBuilder()
.setCollectionName(testName)
.setVectorsConfig(
VectorsConfig.newBuilder()
.setParams(
VectorParams.newBuilder()
.setDistance(Distance.Cosine)
.setSize(4)
.build())
.build())
.setIdTracker(IdTrackerParams.newBuilder().setMemory(Memory.Cached).build())
.build())
.get();

CollectionInfo collectionInfo = client.getCollectionInfoAsync(testName).get();
assertEquals(Memory.Cached, collectionInfo.getConfig().getParams().getIdTracker().getMemory());
assertTrue(collectionInfo.hasCreatedAt());
}

@Test
public void updateCollection_with_no_changes() throws ExecutionException, InterruptedException {
CreateCollection createCollection = getCreateCollection(testName);
Expand Down
Loading
Loading