Skip to content

Commit

Permalink
Remove the random option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikwiss committed Jan 6, 2023
1 parent aa1ca53 commit 268d99f
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,13 @@ public class IndexerBolt extends AbstractIndexerBolt
static final String ESIndexNameParamName = "es.indexer.index.name";
private static final String ESCreateParamName = "es.indexer.create";
private static final String ESIndexPipelineParamName = "es.indexer.pipeline";
private static final String ESIndexRandomIDParamName = "es.indexer.id.random";

private OutputCollector _collector;

private String indexName;

private String pipeline;

private boolean randomID;

// whether the document will be created only if it does not exist or
// overwritten
private boolean create = false;
Expand Down Expand Up @@ -111,7 +108,6 @@ public void prepare(

create = ConfUtils.getBoolean(conf, IndexerBolt.ESCreateParamName, false);
pipeline = ConfUtils.getString(conf, IndexerBolt.ESIndexPipelineParamName);
randomID = ConfUtils.getBoolean(conf, IndexerBolt.ESIndexRandomIDParamName, false);

try {
connection = ElasticSearchConnection.getConnection(conf, ESBoltType, this);
Expand Down Expand Up @@ -266,15 +262,10 @@ public void execute(Tuple tuple) {
*
* @param metadata The {@link Metadata}.
* @param normalisedUrl The normalised url.
* @return An {@link UUID} as String if 'es.indexer.id.random' parameter is true, otherwise the
* normalised url SHA-256 digest as String.
* @return Return the normalised url SHA-256 digest as String.
*/
protected String getDocumentID(Metadata metadata, String normalisedUrl) {
if (randomID) {
return UUID.randomUUID().toString();
} else {
return org.apache.commons.codec.digest.DigestUtils.sha256Hex(normalisedUrl);
}
return org.apache.commons.codec.digest.DigestUtils.sha256Hex(normalisedUrl);
}

/**
Expand Down

0 comments on commit 268d99f

Please sign in to comment.