Skip to content

Commit 25f0630

Browse files
author
Milder Hernandez Cagua
committed
Update docs
1 parent 649099a commit 25f0630

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

semantickernel-experimental/src/main/java/com/microsoft/semantickernel/connectors/data/redis/RedisHashSetVectorStoreRecordCollection.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public Mono<Boolean> collectionExistsAsync() {
156156
public Mono<VectorStoreRecordCollection<String, Record>> createCollectionAsync() {
157157
return Mono.fromRunnable(() -> {
158158
Schema schema = RedisVectorStoreCollectionCreateMapping
159-
.mapToSchema(recordDefinition.getAllFields(), false);
159+
.mapToSchema(recordDefinition.getAllFields(), RedisStorageType.HASH_SET);
160160

161161
IndexDefinition indexDefinition = new IndexDefinition(IndexDefinition.Type.HASH)
162162
.setPrefixes(collectionName + ":");
@@ -264,7 +264,7 @@ public Mono<List<Record>> getBatchAsync(List<String> keys,
264264
.add(new AbstractMap.SimpleEntry<>(key,
265265
pipeline.hgetAll(stringToBytes(redisKey))));
266266
} else {
267-
// Returns List<String> with the values of the fields
267+
// Returns List<byte[]> with the values of the fields
268268
responses
269269
.add(new AbstractMap.SimpleEntry<>(key,
270270
pipeline.hmget(stringToBytes(redisKey), dataFields)));
@@ -411,6 +411,7 @@ public Mono<List<VectorSearchResult<Record>>> searchAsync(VectorSearchQuery quer
411411
(byte[]) entry.getValue());
412412
} else if (entry.getKey().equals(
413413
RedisVectorStoreCollectionSearchMapping.VECTOR_SCORE_FIELD)) {
414+
// Score is stored as a string in one of the fields
414415
score = Double.parseDouble((String) entry.getValue());
415416
}
416417
}

semantickernel-experimental/src/main/java/com/microsoft/semantickernel/connectors/data/redis/RedisJsonVectorStoreRecordCollection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public Mono<Boolean> collectionExistsAsync() {
163163
public Mono<VectorStoreRecordCollection<String, Record>> createCollectionAsync() {
164164
return Mono.fromRunnable(() -> {
165165
Schema schema = RedisVectorStoreCollectionCreateMapping
166-
.mapToSchema(recordDefinition.getAllFields(), true);
166+
.mapToSchema(recordDefinition.getAllFields(), RedisStorageType.JSON);
167167

168168
IndexDefinition indexDefinition = new IndexDefinition(IndexDefinition.Type.JSON)
169169
.setPrefixes(collectionName + ":");

semantickernel-experimental/src/main/java/com/microsoft/semantickernel/connectors/data/redis/RedisVectorStoreCollectionCreateMapping.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ private static String getRedisPath(String name, boolean withRedisJsonRoot) {
7171
}
7272

7373
public static Schema mapToSchema(List<VectorStoreRecordField> fields,
74-
boolean withRedisJsonRoot) {
74+
RedisStorageType storageType) {
7575
Schema schema = new Schema();
76+
boolean withRedisJsonRoot = storageType == RedisStorageType.JSON;
7677

7778
for (VectorStoreRecordField field : fields) {
7879
if (field instanceof VectorStoreRecordKeyField) {

0 commit comments

Comments
 (0)