简体   繁体   English

如何通过Solr中的“ id”更新文档索引?

[英]How to update index of a document by its “id” in Solr?

How can I update or re-index solr index of an existing document in Solr by using its " id "? 如何使用Solr的“ id更新重新编制Solr中现有文档的solr索引? I am using Solr 4.0. 我正在使用Solr 4.0。

I researched but I don't find a definite answer anywhere. 我进行了研究,但在任何地方都找不到明确的答案。

Lucene is an append only store. Lucene是仅附录的商店。 Update syntax in solr would essentially translate into delete and insert. solr中的更新语法实际上将转换为删除和插入。 So we heed to give full document with all its fields to update. 因此,我们注意提供完整的文档及其所有字段以进行更新。 With Solr 4 and above, you have option of atomic update so that you can only update certain fields. 在Solr 4及更高版本中,您可以选择原子更新,以便只能更新某些字段。 In this case there is a constraint that all the solr schema fields should be "stored". 在这种情况下,存在一个约束,即所有“ solr模式”字段都应“存储”。 So internally solr does get and then merge the field into the retrieved document and then insert. 因此,在内部solr确实会获取,然后将该字段合并到检索到的文档中,然后进行插入。

The documentation links below: 以下文档链接:

Update using CSV - The index can also updated using XML 使用CSV更新 -索引也可以使用XML更新

Atomic Update - This just saves on the network to retrieve the document to client and then update. 原子更新 -仅保存在网络上即可将文档检索到客户端,然后进行更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM