From 19b80dc2d1ec7d8014ac299094f2dba1d00bbe8e Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Nov 2023 17:44:01 +0800 Subject: [PATCH] Cleaned up comments and added descriptions for functions --- .../com/linkedin/metadata/search/EntitySearchService.java | 5 +++++ .../metadata/search/elasticsearch/ElasticSearchService.java | 1 + .../metadata/search/elasticsearch/update/ESWriteDAO.java | 6 ++++++ .../search/transformer/SearchDocumentTransformer.java | 1 - 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/metadata-io/src/main/java/com/linkedin/metadata/search/EntitySearchService.java b/metadata-io/src/main/java/com/linkedin/metadata/search/EntitySearchService.java index c5d96757c9219..3ef6fb86ac12f 100644 --- a/metadata-io/src/main/java/com/linkedin/metadata/search/EntitySearchService.java +++ b/metadata-io/src/main/java/com/linkedin/metadata/search/EntitySearchService.java @@ -38,6 +38,11 @@ public interface EntitySearchService { */ void upsertDocument(@Nonnull String entityName, @Nonnull String document, @Nonnull String docId); + /** + * + * @param document the document to update into update index + * @param docId the ID of the document + */ void createUpdateDocument(@Nonnull String document, @Nonnull String docId); /** diff --git a/metadata-io/src/main/java/com/linkedin/metadata/search/elasticsearch/ElasticSearchService.java b/metadata-io/src/main/java/com/linkedin/metadata/search/elasticsearch/ElasticSearchService.java index aceb2ed9a41c4..170285527b361 100644 --- a/metadata-io/src/main/java/com/linkedin/metadata/search/elasticsearch/ElasticSearchService.java +++ b/metadata-io/src/main/java/com/linkedin/metadata/search/elasticsearch/ElasticSearchService.java @@ -70,6 +70,7 @@ public void upsertDocument(@Nonnull String entityName, @Nonnull String document, esWriteDAO.upsertDocument(entityName, document, docId); } + @Override public void createUpdateDocument(@Nonnull String document, @Nonnull String docId) { log.debug(String.format("Creating Update document document: %s, docId %s", document, docId)); esWriteDAO.createUpdateDocument(document, docId); diff --git a/metadata-io/src/main/java/com/linkedin/metadata/search/elasticsearch/update/ESWriteDAO.java b/metadata-io/src/main/java/com/linkedin/metadata/search/elasticsearch/update/ESWriteDAO.java index a90eb1c43c3e2..eced7714b5497 100644 --- a/metadata-io/src/main/java/com/linkedin/metadata/search/elasticsearch/update/ESWriteDAO.java +++ b/metadata-io/src/main/java/com/linkedin/metadata/search/elasticsearch/update/ESWriteDAO.java @@ -48,6 +48,12 @@ public void upsertDocument(@Nonnull String entityName, @Nonnull String document, bulkProcessor.add(updateRequest); } + /** + * Creates a request to insert new document into datahub_update_event index + * + * @param document the document to insert + * @param docId the ID of the document + */ public void createUpdateDocument(@Nonnull String document, @Nonnull String docId) { final String indexName = indexConvention.getIndexName("datahub_update_event"); final IndexRequest indexRequest = new IndexRequest( diff --git a/metadata-io/src/main/java/com/linkedin/metadata/search/transformer/SearchDocumentTransformer.java b/metadata-io/src/main/java/com/linkedin/metadata/search/transformer/SearchDocumentTransformer.java index 29fba6992c72a..e6eb31c8983cd 100644 --- a/metadata-io/src/main/java/com/linkedin/metadata/search/transformer/SearchDocumentTransformer.java +++ b/metadata-io/src/main/java/com/linkedin/metadata/search/transformer/SearchDocumentTransformer.java @@ -84,7 +84,6 @@ public Optional transformAspect( return Optional.of(searchDocument.toString()); } - //TODO: Transform event into a JSON-like string to upsert into search public String transformEvent(MetadataChangeLog event) { final ObjectNode searchDocument = JsonNodeFactory.instance.objectNode(); searchDocument.put("urn", event.getEntityUrn().toString());