|
16 | 16 | package org.springframework.data.mongodb.core.aggregation;
|
17 | 17 |
|
18 | 18 | import static org.assertj.core.api.Assertions.assertThat;
|
19 |
| -import static org.assertj.core.api.Assertions.assertThatRuntimeException; |
20 | 19 |
|
21 | 20 | import java.util.stream.IntStream;
|
22 | 21 | import java.util.stream.Stream;
|
@@ -54,7 +53,7 @@ public class VectorSearchTests {
|
54 | 53 | static final String COLLECTION_NAME = "collection-1";
|
55 | 54 | static MongoClient client;
|
56 | 55 | static MongoTestTemplate template;
|
57 |
| - private static @Container AtlasContainer atlasLocal = new AtlasContainer(); |
| 56 | + private static @Container AtlasContainer atlasLocal = AtlasContainer.bestMatch(); |
58 | 57 |
|
59 | 58 | @BeforeAll
|
60 | 59 | static void beforeAll() throws InterruptedException {
|
@@ -94,19 +93,13 @@ void searchUsingBinaryVectorAddingScore(VectorSearchOperation searchOperation) {
|
94 | 93 |
|
95 | 94 | VectorSearchOperation $search = searchOperation.withSearchScore(SCORE_FIELD);
|
96 | 95 |
|
97 |
| - assertThatRuntimeException().isThrownBy( |
98 |
| - () -> template.aggregate(Aggregation.newAggregation($search), WithVectorFields.class, Document.class)); |
99 |
| - |
100 |
| - /* just in case the above starts working uncomment lines below: |
101 |
| - * |
102 |
| - * AggregationResults<Document> results = template.aggregate(Aggregation.newAggregation($search), |
103 |
| - * WithVectorFields.class, Document.class); |
104 |
| - * |
105 |
| - * assertThat(results).hasSize(10); |
106 |
| - * assertScoreIsDecreasing(results); |
107 |
| - * assertThat(results.iterator().next()).containsKey(SCORE_FIELD) |
108 |
| - * .extracting(it -> it.get(SCORE_FIELD), InstanceOfAssertFactories.DOUBLE).isEqualByComparingTo(1D); |
109 |
| - */ |
| 96 | + AggregationResults<Document> results = template.aggregate(Aggregation.newAggregation($search), |
| 97 | + WithVectorFields.class, Document.class); |
| 98 | + |
| 99 | + assertThat(results).hasSize(10); |
| 100 | + assertScoreIsDecreasing(results); |
| 101 | + assertThat(results.iterator().next()).containsKey(SCORE_FIELD) |
| 102 | + .extracting(it -> it.get(SCORE_FIELD), InstanceOfAssertFactories.DOUBLE).isEqualByComparingTo(1D); |
110 | 103 | }
|
111 | 104 |
|
112 | 105 | private static Stream<Arguments> binaryVectorAggregations() {
|
|
0 commit comments