public static void update(String id, Object fieldValue)
throws IOException, SolrServerException {
HashMap<String, Object> oper = new
HashMap<String, Object>();
oper.put("set", fieldValue);
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id", id);
doc.addField("fieldName", oper);
HttpSolrClient client = new HttpSolrClient(baseURL);
client.add(doc);
client.commit();
}
转载地址:http://blog.chinaunix.net/uid-79084-id-5098001.html
Solr文档更新方法
本文介绍了一种使用Java API更新Solr中特定文档字段的方法。通过构造含有更新操作的SolrInputDocument对象,并利用HttpSolrClient将其提交给Solr服务器来实现。此方法允许设置文档的ID并更新指定字段的值。
4988

被折叠的 条评论
为什么被折叠?



