java - Lucene wants to delete field as specified value data
欧阳克
欧阳克 2017-07-03 11:43:30
0
1
873
Document document = new Document();
// 向Document对象中添加域信息
// 参数:1、域的名称;2、域的值;3、是否存储;
Field contentField = new TextField("content", labelformat(t.getContent()), Store.YES);
// storedFiled默认存储
Field tidField = new StoredField("tid", t.getTopicId());
// 将域添加到document对象中
document.add(contentField);
document.add(tidField);
// 将信息写入到索引库中
indexWriter.addDocument(document);

I want to delete the index data with tid 1, I tried it

indexWriter.deleteDocuments() 

But the input parameters can only be query or term objects, and it has never been successful.
What should be done correctly? ?

欧阳克
欧阳克

温故而知新,可以为师矣。 博客:www.ouyangke.com

reply all(1)
巴扎黑

Baidu has found a solution, try it and it will work
http://www.it610.com/article/...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template