Lucene in Action阅读笔记(1)--Yin

为了保证项目按时完成,我每天都会抽出一定的时间阅读《Lucene in Action 2nd edtion》,以下为读书笔记,形式可能略显杂乱,但都是我的个人心得,或者原文摘录的经典之处。

1. how to delete a Document or update a existing Document

Delete a Document

deleteDocuments(Term)  deletes all documents containing the provided term.
deleteDocuments(Term[])  deletes all documents containing any of the terms in the provided array.
deleteDocuments(Query)  deletes all documents matching the provided query.
deleteDocuments(Query[])  deletes all documents matching any of the queries in the provided array.
deleteAll()  deletes all documents in the index. This is exactly the same as closing the writer and opening a new writer with create=true, without having to close your writer

Usage:

writer.deleteDocuments(new Term("ID", documentID));

Update a Document

writer.updateDocument(new Term("ID", documenteId), newDocument);

Warning:由于updateDocument()内部通过调用deleteDocuments首先删除包含指定Term的文档,因此,需要保证Term的唯一性

转载于:https://www.cnblogs.com/magiccode1023/archive/2012/11/30/2795591.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值