FieldMapper fieldMapper = getFieldMapper();
int numDocs = ids.size(); // for debuging
try {
ids = checkRepresentations(server, fieldMapper,ids); // returns the ids found in the solrIndex
} catch (SolrServerException e) {
throw new YardException(
"Error while searching for alredy present documents before executing the actual update for the parsed Representations",
e);
} catch (IOException e) {
throw new YardException("Unable to access SolrServer", e);
}
long checked = System.currentTimeMillis();
List<SolrInputDocument> inputDocs = new ArrayList<SolrInputDocument>(ids.size());
List<Representation> updated = new ArrayList<Representation>();
for (Representation representation : representations) {
if (representation != null && ids.contains(representation.getId())) { // null parsed or not
// already present
inputDocs.add(createSolrInputDocument(fieldMapper,representation));
updated.add(representation);
}
}
long created = System.currentTimeMillis();
if (!inputDocs.isEmpty()) {
try {
UpdateRequest update = new UpdateRequest();
if (!immediateCommit) {
update.setCommitWithin(commitWithin);
}
update.add(inputDocs);
update.process(server);
if (immediateCommit) {
server.commit();
}
} catch (SolrServerException e) {
throw new YardException("Error while adding updated Documents to the SolrServer", e);
} catch (IOException e) {
throw new YardException("Unable to access Solr server", e);
}
}
long ready = System.currentTimeMillis();
log.info(String
.format(