开发者

lucene delete record, deprecated?

开发者 https://www.devze.com 2023-01-16 22:57 出处:网络
When doing research on deleting documents in lucene I have been shown to use the IndexReaders delete() method, passing in the document id.Now that I actually need to do this, it appears that lucene cu

When doing research on deleting documents in lucene I have been shown to use the IndexReaders delete() method, passing in the document id. Now that I actually need to do this, it appears that lucene currently does not support this method, and I have had very little luck in finding the current way to do this.

An开发者_如何学Pythony ideas?


now the deletions can be done with IndexWriter

http://lucene.apache.org/java/3_0_2/api/all/org/apache/lucene/index/IndexWriter.html


Doc IDs are internal to Lucene, and really should never be used. They are liable to change without warning, among other issues.

How are you getting the doc IDs? Presumably through a query? Then just delete based on that query. Alternatively, if you have your own unique ID field, you can do writer.DeleteDocuments(new Term("MyIDField", "ID to delete"));

0

精彩评论

暂无评论...
验证码 换一张
取 消