From 43e92f2191caf86b31b94ff5891d57e9bb0b41cd Mon Sep 17 00:00:00 2001 From: Mirko Zizzari Date: Tue, 21 May 2024 10:46:31 +0200 Subject: [PATCH] issue #932: skip index document --- .../pipeline/actor/EnrichPipeline.java | 17 +++++++++++++++++ .../validator/ResourcesValidatorProcessor.java | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/actor/EnrichPipeline.java b/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/actor/EnrichPipeline.java index a9dbaf730..68af7546a 100644 --- a/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/actor/EnrichPipeline.java +++ b/core/app/datasource/src/main/java/io/openk9/datasource/pipeline/actor/EnrichPipeline.java @@ -323,6 +323,23 @@ else if (r instanceof EnrichItemSupervisor.Error) { newJsonPayload = result; } + if (newJsonPayload.getBoolean("_openk9SkipDocument", false)) { + + log.infof( + "Document with contentId %s can be skipped.", + dataPayload.getContentId() + ); + + replyTo.tell(new Success( + dataPayload.getContentId(), + consumer, + dataPayload.getScheduleId(), + dataPayload.getTenantId() + )); + + return Behaviors.stopped(); + } + DataPayload newDataPayload = mergeResponse( jsonPath, behaviorMergeType, dataPayload, diff --git a/core/app/resources-validator/src/main/java/io/openk9/resources/validator/ResourcesValidatorProcessor.java b/core/app/resources-validator/src/main/java/io/openk9/resources/validator/ResourcesValidatorProcessor.java index b539eecc8..dec743fc4 100644 --- a/core/app/resources-validator/src/main/java/io/openk9/resources/validator/ResourcesValidatorProcessor.java +++ b/core/app/resources-validator/src/main/java/io/openk9/resources/validator/ResourcesValidatorProcessor.java @@ -134,7 +134,7 @@ public JsonObject consume(ResourcesValidatorDataPayload resourcesValidatorPayloa "document found. dropped message with contentId: " + contentId); - return JsonObject.of("toIndex", true); + return JsonObject.of("_openk9SkipDocument", true); } } } @@ -143,7 +143,7 @@ public JsonObject consume(ResourcesValidatorDataPayload resourcesValidatorPayloa logger.info("Index wit name: " + indexName + " not exist. Item go to next enrich step."); } - return JsonObject.of("hashCodes", hashCodes, "toIndex", false); + return JsonObject.of("hashCodes", hashCodes, "_openk9SkipDocument", false); } catch (IOException e) {