diff --git a/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/actor/VectorIndexWriter.java b/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/actor/VectorIndexWriter.java index 626365210..440764358 100644 --- a/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/actor/VectorIndexWriter.java +++ b/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/actor/VectorIndexWriter.java @@ -29,7 +29,6 @@ import io.openk9.datasource.pipeline.stages.working.Writer; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.Json; -import io.vertx.core.json.JsonObject; import org.jboss.logging.Logger; import org.opensearch.client.opensearch.OpenSearchAsyncClient; import org.opensearch.client.opensearch._types.ErrorCause; @@ -236,11 +235,20 @@ private Behavior onIndexDocument(IndexDocument indexDocument) { var bulkOperations = new ArrayList(); for (EmbeddingService.EmbeddedChunk chunk : embeddedChunks.list()) { - var document = JsonObject.mapFrom(chunk); - Map acl = (Map) document.getValue("acl"); + var document = chunk; + + var acl = chunk.acl(); if (acl == null || acl.isEmpty()) { - document.put("acl", Map.of("public", true)); + document = new EmbeddingService.EmbeddedChunk( + chunk.indexName(), + chunk.contentId(), + Map.of("public", true), + chunk.number(), + chunk.total(), + chunk.chunkText(), + chunk.vector() + ); } var bulkOperation = new BulkOperation.Builder() diff --git a/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/service/EmbeddingService.java b/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/service/EmbeddingService.java index 38b38bc54..09bc970a1 100644 --- a/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/service/EmbeddingService.java +++ b/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/service/EmbeddingService.java @@ -75,7 +75,7 @@ public static CompletionStage getEmbeddedPayload( String text = documentContext.read(configurations.fieldJsonPath); String contentId = documentContext.read("$.contentId"); - Map> acl = documentContext.read("$.acl"); + Map acl = documentContext.read("$.acl"); return client.getMessages(EmbeddingOuterClass.EmbeddingRequest.newBuilder() .setApiKey(apiKey) @@ -159,7 +159,7 @@ public record EmbeddingConfiguration( public record EmbeddedChunk( String indexName, String contentId, - Map> acl, + Map acl, int number, int total, String chunkText,