|
10 | 10 | import static apoc.vectordb.VectorDbTestUtil.EntityType.*; |
11 | 11 | import static apoc.vectordb.VectorDbUtil.ERROR_READONLY_MAPPING; |
12 | 12 | import static apoc.vectordb.VectorEmbeddingConfig.ALL_RESULTS_KEY; |
| 13 | +import static apoc.vectordb.VectorEmbeddingConfig.FIELDS_KEY; |
13 | 14 | import static apoc.vectordb.VectorEmbeddingConfig.MAPPING_KEY; |
14 | 15 | import static apoc.vectordb.VectorMappingConfig.*; |
15 | 16 | import static org.assertj.core.api.Assertions.assertThat; |
16 | 17 | import static org.junit.Assert.assertEquals; |
17 | 18 | import static org.junit.Assert.assertFalse; |
18 | 19 | import static org.junit.Assert.assertNotNull; |
19 | 20 | import static org.junit.Assert.assertNull; |
| 21 | +import static org.junit.Assert.assertTrue; |
20 | 22 | import static org.junit.Assert.fail; |
21 | 23 | import static org.neo4j.configuration.GraphDatabaseSettings.DEFAULT_DATABASE_NAME; |
22 | 24 | import static org.neo4j.configuration.GraphDatabaseSettings.SYSTEM_DATABASE_NAME; |
@@ -167,6 +169,24 @@ public void writeOperationWithReadOnlyUser() { |
167 | 169 | assertThat(e.getMessage()).contains("HTTP response code: 403"); |
168 | 170 | } |
169 | 171 | } |
| 172 | + |
| 173 | + @Test |
| 174 | + public void queryWithWrongEmbeddingSize() { |
| 175 | + Map<String, Object> conf = map(ALL_RESULTS_KEY, true, |
| 176 | + FIELDS_KEY, FIELDS, |
| 177 | + HEADERS_KEY, READONLY_AUTHORIZATION); |
| 178 | + |
| 179 | + |
| 180 | + try { |
| 181 | + testCall(db, "CALL apoc.vectordb.weaviate.query($host, 'TestCollection', [0.2, 0.1, 0.9], null, 5, $conf)", |
| 182 | + map("host", HOST, "conf", conf), |
| 183 | + r -> fail()); |
| 184 | + } catch (Exception e) { |
| 185 | + String message = e.getMessage(); |
| 186 | + String expectedErrMsg = "distance between entrypoint and query node: vector lengths don't match: 4 vs 3"; |
| 187 | + assertTrue(message.contains(expectedErrMsg)); |
| 188 | + } |
| 189 | + } |
170 | 190 |
|
171 | 191 | @Test |
172 | 192 | public void getVectorsWithoutVectorResult() { |
|
0 commit comments