文章詳情頁
java - Lucene 想刪除field 為指定值得數(shù)據(jù)
瀏覽:135日期:2023-10-18 18:19:52
問題描述
Document document = new Document();// 向Document對象中添加域信息// 參數(shù):1、域的名稱;2、域的值;3、是否存儲;Field contentField = new TextField('content', labelformat(t.getContent()), Store.YES);// storedFiled默認(rèn)存儲Field tidField = new StoredField('tid', t.getTopicId());// 將域添加到document對象中document.add(contentField);document.add(tidField);// 將信息寫入到索引庫中indexWriter.addDocument(document);
我想刪除tid 為1的索引數(shù)據(jù),嘗試了下
indexWriter.deleteDocuments()
但是入?yún)⒅荒苁莙uery或者term對象,一直沒成功。請問下正確的應(yīng)該如何做??
問題解答
回答1:百度到了解決方法,嘗試了下可以成功http://www.it610.com/article/...
標(biāo)簽:
java
相關(guān)文章:
1. 如何解決Centos下Docker服務(wù)啟動無響應(yīng),且輸入docker命令無響應(yīng)?2. 我在centos容器里安裝docker,也就是在容器里安裝容器,報錯了?3. objective-c - IOS 分享到微信 提示 應(yīng)用消息數(shù)據(jù)錯誤4. android - 使用百度sdk調(diào)用SDKInitializer.initialize(this)時報錯?5. javascript - 微信h5發(fā)送圖文信息,部分設(shè)備點(diǎn)擊“發(fā)送”按鈕時沒反應(yīng),問題較難重現(xiàn),如何能找到可能存在問題的點(diǎn)?6. javascript - 音樂播放器-圖片旋轉(zhuǎn)7. android - 為 AppBarLayout 設(shè)置的背景圖片 TransitionDrawable 為什么只在第一次打開的時候有效?8. javascript - js中遞歸與for循環(huán)同時發(fā)生的時候,代碼的執(zhí)行順序是怎樣的?9. MySQL timestamp的默認(rèn)值怎么設(shè)置?10. docker 17.03 怎么配置 registry mirror ?
排行榜

熱門標(biāo)簽