|
|
|
@ -4,6 +4,8 @@ import eu.dnetlib.ariadneplus.elasticsearch.model.AriadnePlusEntry;
|
|
|
|
|
import eu.dnetlib.ariadneplus.elasticsearch.model.AriadneResource;
|
|
|
|
|
import eu.dnetlib.ariadneplus.elasticsearch.model.Spatial;
|
|
|
|
|
import eu.dnetlib.ariadneplus.reader.ResourceManager;
|
|
|
|
|
import eu.dnetlib.ariadneplus.reader.utils.ESUtils;
|
|
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
@ -28,7 +30,10 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.xml.bind.DatatypeConverter;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.security.MessageDigest;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -188,12 +193,13 @@ public class BulkUpload {
|
|
|
|
|
ace.getSpatial().clear();
|
|
|
|
|
ace.setSpatial(dedupSpatials);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String[] splits = ace.getIdentifier().split("/");
|
|
|
|
|
|
|
|
|
|
log.debug("JSON >>>> "+ace.toJson());
|
|
|
|
|
|
|
|
|
|
String idES = splits[splits.length-1];
|
|
|
|
|
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
|
|
|
|
byte[] encodedhash = digest.digest(
|
|
|
|
|
ace.getIdentifier().getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
String idES = ESUtils.bytesToHex(encodedhash);
|
|
|
|
|
log.debug("indexing " + ace.getIdentifier() + " > " + idES);
|
|
|
|
|
request.add(new IndexRequest(elasticSearchIndexName).id(idES)
|
|
|
|
|
.source(ace.toJson(),XContentType.JSON));
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|