我想更新solr中某個文檔的特定字段。但是,儘管如此,文檔的其他 字段將變爲空。在solr中更新文檔
CommonsHttpSolrServer server = new CommonsHttpSolrServer("http://mydomain:8983/solr/index_socialmedia/");
List<SolrInputDocument> solrInputDocsList = new ArrayList<SolrInputDocument>();
SolrInputDocument solrInputDoc = new SolrInputDocument();
solrInputDoc.addField("id","427832898745234516478592");
solrInputDoc.addField("city","Kolkata");
solrInputDocsList.add(solrInputDoc);
server.add(solrInputDocsList);
server.commit();
在上面的代碼中,「id」字段是唯一字段。 我該如何解決這個問題。
這不是** uniqueKey **的問題。 Vijay在他的問題中提到過。「**」id「字段是唯一字段**」 – buddy86