文章詳情頁
java - Lucene 想刪除field 為指定值得數(shù)據(jù)
瀏覽:114日期:2023-10-18 18:19:52
問題描述
Document document = new Document();// 向Document對(duì)象中添加域信息// 參數(shù):1、域的名稱;2、域的值;3、是否存儲(chǔ);Field contentField = new TextField('content', labelformat(t.getContent()), Store.YES);// storedFiled默認(rèn)存儲(chǔ)Field tidField = new StoredField('tid', t.getTopicId());// 將域添加到document對(duì)象中document.add(contentField);document.add(tidField);// 將信息寫入到索引庫中indexWriter.addDocument(document);
我想刪除tid 為1的索引數(shù)據(jù),嘗試了下
indexWriter.deleteDocuments()
但是入?yún)⒅荒苁莙uery或者term對(duì)象,一直沒成功。請(qǐng)問下正確的應(yīng)該如何做??
問題解答
回答1:百度到了解決方法,嘗試了下可以成功http://www.it610.com/article/...
標(biāo)簽:
java
相關(guān)文章:
1. Span標(biāo)簽2. docker-machine添加一個(gè)已有的docker主機(jī)問題3. redis啟動(dòng)有問題?4. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””5. angular.js使用$resource服務(wù)把數(shù)據(jù)存入mongodb的問題。6. javascript - 計(jì)算面積函數(shù)代碼7. javascript - ng-options 設(shè)置默認(rèn)選項(xiàng),不是設(shè)置第一個(gè)哦,看清楚了!8. SessionNotFoundException:會(huì)話ID為null。調(diào)用quit()后使用WebDriver嗎?(硒)9. java - Spring MVC無法識(shí)別Controller導(dǎo)致返回的結(jié)果是404?10. java - Collections類里的swap函數(shù),源碼為什么要新定義一個(gè)final的List型變量l指向傳入的list?
排行榜

熱門標(biāo)簽