solrj修改一条记录中的某个field字段的值

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

猜你喜欢

转载自blog.csdn.net/zhanghe687/article/details/78899537