您的位置:首页 > 其它

solr原子更新-即指定更新某个字段的值

2016-09-20 00:00 225 查看
官方文档:https://wiki.apache.org/solr/Atomic_Updates

SolrInputDocument solrInputDocument = new SolrInputDocument();
solrInputDocument.addField("id", id);
Map<String, String > operation = new HashMap<>();
operation.put("set", "test1");
solrInputDocument.addField("title", operation);
solrServer.add(solrInputDocument);
solrServer.commit();

官方文档中,要注意:

The core functionality of atomically updating a document requires that all fields in your SchemaXml must be configured as stored="true"

solr原子更新,支持store=true,如果store为false,更新后字段会丢失。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息