Quantcast
Channel: How to update the existing field of solr index using java? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by MatsLindh for How to update the existing field of solr index using java?

$
0
0

Your code isn't changing anything, since you've commented out the .add command. And you have to use the actual ID in the ID field, since Solr won't know what document to update otherwise. The field you're changing should have the fieldModifier attached:

SolrInputDocument doc = new SolrInputDocument();Map<String, String> fieldModifier = new HashMap<String, String>();// Change ModifyScore to the new value, since you're just using the current value now..fieldModifier.put("set", ModifyScore);doc.addField("ID", Mscore);doc.addField("Author", fieldModifier);solr.add(doc);solr.commit();

Viewing all articles
Browse latest Browse all 2

Trending Articles