Answering myself, the solution is to update my code as follows:
UpdateRequest request = new UpdateRequest();
request.setParam("update.chain", "skipexisting");
for (Map.Entry user : users.entrySet()) {
SolrInputDocument document = new SolrInputDocument();
document.addField("id", user.key().toString());
document.addField("applications", Collections.singletonMap("set",
user.value()));
request.add(document);
request.process(solrClient);
}
solrClient.commit();
On 29/01/2019 16:27, Chris Wareham wrote:
I'm trying to update records in my Solr core, and have configured a
custom update chain that skips updates to records that don't exist:
true
true
My SolrJ update code is currently:
for (Map.Entry user : users.entrySet()) {
SolrInputDocument document = new SolrInputDocument();
document.addField("id", user.key().toString());
document.addField("applications", Collections.singletonMap("set",
user.value()));
solrClient.add(document);
}
solrClient.commit();
I can't seem to specify the update chain to use and I assume I need to
use the UpdateRequest class. However, it's not clear how I go about
setting a parameter on the UpdateRequest in order to specify the update
chain.
Chris