Skip to content

Commit

Permalink
adding log message when indexing document (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
truhacevkir authored Oct 15, 2024
1 parent 6095919 commit e53fa0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class IndexResourceHandler
ENVIRONMENT.readEnv("EXPANDED_RESOURCES_BUCKET");
private static final String SENT_TO_RECOVERY_QUEUE_MESSAGE =
"IndexDocument for index {} has been sent to recovery queue: {}";
public static final String INDEXING_MESSAGE = "Indexing document with id: {} to {}";

private final S3Driver resourcesS3Driver;
private final IndexingClient indexingClient;
Expand Down Expand Up @@ -69,6 +70,10 @@ protected Void processInputPayload(
var indexDocument = fetchFileFromS3Bucket(resourceRelativePath).validate();
attempt(() -> indexingClient.addDocumentToIndex(indexDocument))
.orElse(failure -> persistRecoveryMessage(failure, indexDocument));
LOGGER.info(
INDEXING_MESSAGE,
indexDocument.getDocumentIdentifier(),
indexDocument.getIndexName());
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import no.unit.nva.commons.json.JsonSerializable;
import no.unit.nva.identifiers.SortableIdentifier;

public record DeleteImportCandidateEvent(String topic, SortableIdentifier identifier) implements JsonSerializable {
public record DeleteImportCandidateEvent(String topic, SortableIdentifier identifier)
implements JsonSerializable {

public static final String EVENT_TOPIC = "ImportCandidates.ExpandedEntry.Deleted";
public static final String TOPIC = "topic";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
import static no.unit.nva.constants.Words.VIEWED_BY;
import static no.unit.nva.search.common.constant.Functions.branchBuilder;
import static no.unit.nva.search.common.constant.Functions.filterBranchBuilder;
import java.util.List;
import java.util.Map;

import nva.commons.core.JacocoGenerated;

import org.opensearch.search.aggregations.AggregationBuilder;

import java.util.List;
import java.util.Map;

/**
* Constants for the ticket search.
*
Expand Down

0 comments on commit e53fa0c

Please sign in to comment.