Skip to content

Commit b0dbb37

Browse files
author
Milder Hernandez Cagua
committed
Fix test
1 parent 12a0925 commit b0dbb37

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

api-test/integration-tests/src/test/java/com/microsoft/semantickernel/tests/connectors/memory/jdbc/JDBCVectorStoreRecordCollectionTest.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,27 @@ public void exactSearch(QueryProvider provider, String embeddingName) {
335335
List<Hotel> hotels = getHotels();
336336
recordCollection.upsertBatchAsync(hotels, null).block();
337337

338+
VectorSearchOptions options = VectorSearchOptions.builder()
339+
.withVectorFieldName(embeddingName)
340+
.withLimit(3)
341+
.build();
342+
338343
// Embeddings similar to the third hotel
339344
List<Float> embeddings = Arrays.asList(4.5f, -6.2f, 3.1f, 7.7f, -0.8f, 1.1f, -2.2f, 8.2f);
340-
List<VectorSearchResult<Hotel>> results = recordCollection.searchAsync(embeddings, null).block();
345+
List<VectorSearchResult<Hotel>> results = recordCollection.searchAsync(embeddings, options).block();
341346
assertNotNull(results);
342347
assertEquals(3, results.size());
343348
// The third hotel should be the most similar
344349
assertEquals(hotels.get(2).getId(), results.get(0).getRecord().getId());
345350

351+
options = VectorSearchOptions.builder()
352+
.withVectorFieldName(embeddingName)
353+
.withOffset(1)
354+
.withLimit(-100)
355+
.build();
356+
346357
// Skip the first result
347-
results = recordCollection.searchAsync(embeddings, VectorSearchOptions.builder().withOffset(1).withLimit(-100).build()).block();
358+
results = recordCollection.searchAsync(embeddings, options).block();
348359
assertNotNull(results);
349360
assertEquals(1, results.size());
350361
// The first hotel should be the most similar

0 commit comments

Comments
 (0)