Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexer ES document id #1028

Merged
merged 4 commits into from
Jan 10, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void execute(Tuple tuple) {
return;
}

String docID = org.apache.commons.codec.digest.DigestUtils.sha256Hex(normalisedurl);
String docID = getDocumentID(metadata, normalisedurl);

try {
XContentBuilder builder = jsonBuilder().startObject();
Expand Down Expand Up @@ -257,6 +257,17 @@ public void execute(Tuple tuple) {
}
}

/**
* Get the document id.
*
* @param metadata The {@link Metadata}.
* @param normalisedUrl The normalised url.
* @return Return the normalised url SHA-256 digest as String.
*/
protected String getDocumentID(Metadata metadata, String normalisedUrl) {
return org.apache.commons.codec.digest.DigestUtils.sha256Hex(normalisedUrl);
}

/**
* Must be overridden for implementing custom index names based on some metadata information By
* Default, indexName coming from config is used
Expand Down