mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
1 parent
8a673fc580
commit
bd8d99b757
7 files changed
+550
-14
No files matched your search
@@ -128,12 +128,16 @@ class S3VectorsTest {
|
||||
PutInputVector.builder()
|
||||
.key("v1")
|
||||
.data(VectorData.builder().float32(1.0f, 0.0f, 0.0f).build())
|
||||
.metadata(Document.fromMap(Map.of("label", Document.fromString("first"))))
|
||||
.metadata(Document.fromMap(Map.of(
|
||||
"label", Document.fromString("first"),
|
||||
"tenant", Document.fromString("tenant-a"))))
|
||||
.build(),
|
||||
PutInputVector.builder()
|
||||
.key("v2")
|
||||
.data(VectorData.builder().float32(0.0f, 1.0f, 0.0f).build())
|
||||
.metadata(Document.fromMap(Map.of("label", Document.fromString("second"))))
|
||||
.metadata(Document.fromMap(Map.of(
|
||||
"label", Document.fromString("second"),
|
||||
"tenant", Document.fromString("tenant-b"))))
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
@@ -185,6 +189,26 @@ class S3VectorsTest {
|
||||
|
||||
@Test
|
||||
@Order(10)
|
||||
void queryVectorsWithMetadataFilter() {
|
||||
QueryVectorsResponse response = client.queryVectors(
|
||||
QueryVectorsRequest.builder()
|
||||
.vectorBucketName(bucketName)
|
||||
.indexName(indexName)
|
||||
.queryVector(VectorData.builder().float32(1.0f, 0.0f, 0.0f).build())
|
||||
.topK(1)
|
||||
.filter(Document.fromMap(Map.of("tenant", Document.fromString("tenant-b"))))
|
||||
.returnMetadata(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
assertThat(response.vectors()).singleElement().satisfies(result -> {
|
||||
assertThat(result.key()).isEqualTo("v2");
|
||||
assertThat(result.metadata().asMap().get("tenant").asString()).isEqualTo("tenant-b");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(11)
|
||||
void deleteVectors() {
|
||||
client.deleteVectors(
|
||||
DeleteVectorsRequest.builder()
|
||||
@@ -206,7 +230,7 @@ class S3VectorsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(11)
|
||||
@Order(12)
|
||||
void testConflictException() {
|
||||
assertThatThrownBy(() -> client.createVectorBucket(
|
||||
CreateVectorBucketRequest.builder()
|
||||
@@ -216,7 +240,7 @@ class S3VectorsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(12)
|
||||
@Order(13)
|
||||
void testNotFoundException() {
|
||||
assertThatThrownBy(() -> client.getVectorBucket(
|
||||
GetVectorBucketRequest.builder()
|
||||
@@ -226,7 +250,7 @@ class S3VectorsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(13)
|
||||
@Order(14)
|
||||
void testValidationException() {
|
||||
assertThatThrownBy(() -> client.createIndex(
|
||||
CreateIndexRequest.builder()
|
||||
|
||||
Reference in new issue
Block a user