|
5 | 5 | import com.microsoft.semantickernel.data.vectorsearch.VectorSearchResult;
|
6 | 6 | import com.microsoft.semantickernel.data.vectorstorage.VectorStoreRecordMapper;
|
7 | 7 | import com.microsoft.semantickernel.data.vectorstorage.definition.DistanceFunction;
|
| 8 | +import com.microsoft.semantickernel.data.vectorstorage.definition.IndexKind; |
8 | 9 | import com.microsoft.semantickernel.data.vectorstorage.definition.VectorStoreRecordDefinition;
|
9 | 10 | import com.microsoft.semantickernel.data.vectorstorage.definition.VectorStoreRecordField;
|
10 | 11 | import com.microsoft.semantickernel.data.vectorstorage.definition.VectorStoreRecordVectorField;
|
@@ -263,7 +264,9 @@ public void createCollection(String collectionName,
|
263 | 264 |
|
264 | 265 | // No approximate search is supported in JDBCVectorStoreQueryProvider
|
265 | 266 | if (recordDefinition.getVectorFields().stream()
|
266 |
| - .anyMatch(field -> field.getIndexKind() != null)) { |
| 267 | + .anyMatch( |
| 268 | + field -> field.getIndexKind() != null && field.getIndexKind() != IndexKind.FLAT |
| 269 | + && field.getIndexKind() != IndexKind.UNDEFINED)) { |
267 | 270 | LOGGER
|
268 | 271 | .warn(String.format("Indexes are not supported in %s. Ignoring indexKind property.",
|
269 | 272 | this.getClass().getName()));
|
@@ -532,9 +535,10 @@ public <Record> List<VectorSearchResult<Record>> search(String collectionName,
|
532 | 535 | List<Record> records = getRecordsWithFilter(collectionName, recordDefinition, mapper,
|
533 | 536 | new GetRecordOptions(true), filter, parameters);
|
534 | 537 |
|
535 |
| - DistanceFunction distanceFunction = vectorField.getDistanceFunction() == null |
536 |
| - ? DistanceFunction.EUCLIDEAN_DISTANCE |
537 |
| - : vectorField.getDistanceFunction(); |
| 538 | + DistanceFunction distanceFunction = vectorField |
| 539 | + .getDistanceFunction() == DistanceFunction.UNDEFINED |
| 540 | + ? DistanceFunction.EUCLIDEAN_DISTANCE |
| 541 | + : vectorField.getDistanceFunction(); |
538 | 542 |
|
539 | 543 | return VectorOperations.exactSimilaritySearch(records, vector, vectorField,
|
540 | 544 | distanceFunction, options);
|
|
0 commit comments