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? ?
Baidu has found a solution, try it and it will work
http://www.it610.com/article/...