我有一個索引,應該頻繁更新(請參閱Lucene indexing and searching at the same time)。因此,首先我創建index-1,然後在其上放置lucene IndexSearcher。 Tomcat上的Web應用程序在Servlet上使用它來供用戶搜索。然後,我做索引2(更新!)。我想將IndexSearcher更改爲新索引並刪除舊索引(index-1),而不會在Tomcat上停止我的Web應用程序。有任何想法嗎!?在運行Tomcat時更改Lucene搜索器
0
A
回答
1
使用新的NRTManager。重新打開整個索引是不好的。
0
你不需要兩個索引。您可以在應用程序只使用一個IndexWriter類,並在每個新的搜索在下列方式
IndexWriter indexWriter;
public List search(){
IndexReader indexReader = IndexReader.open(indexWriter, false);
IndexSearcher indexSearcher = new IndexSearcher(indexReader);
//do search and return answer
}
在這種情況下,性能會相當不錯創建IndexSearch。我使用Lucene 3.5。
相關問題
- 1. 在hadoop上運行lucene搜索出錯
- 2. Lucene並行搜索
- 3. 和運營商在休眠(lucene)搜索
- 4. Lucene搜索管理器
- 5. Lucene的近實時搜索
- 6. 在lucene中縮短索引的搜索時間更長
- 7. 搜索Lucene索引
- 8. 搜索Lucene索引
- 9. Lucene索引搜索
- 10. lucene搜索
- 11. Lucene搜索
- 12. Lucene搜索zf2
- 13. Magento Lucene搜索
- 14. Lucene Sentence搜索
- 15. Lucene,在一個文件上更改搜索
- 16. 在Zend Lucene中,我如何更改查詢搜索的字段?
- 17. Lucene:搜索時加載索引文件?
- 18. Sitemesh在運行時更改裝飾器
- 19. WPF Listbox在運行時更改容器
- 20. DataGridView在運行時更改顯示器
- 21. 在運行時更改適配器
- 22. 在lucene中進行相對搜索(非地理空間搜索)
- 23. Spring JPA + Hibernate搜索:如何僅更新搜索索引(Lucene)?
- 24. 關於lucene搜索器優化器〜
- 25. Lucene搜索標識改變字
- 26. 使用hitcollector改善Lucene搜索速度
- 27. 在Lucene中更改索引格式
- 28. 模糊搜索在Lucene的
- 29. Lucene在Alfresco中搜索
- 30. 在MultiFields上搜索lucene
我該如何使用它!? – 2012-02-16 09:24:09
這沒有很好的文件。閱讀JavaDocs和Mike Mcandless的Changing Bits博客。 (儘管api自發布之後發生了一些變化)。要點是:您打開一個編錄器,並僅在應用程序終止時關閉它。 NRTManager通過這個索引編寫器被實例化爲一個單例。然後,您只能從NRTManager獲取Indexsearchers,並記得返回它們。然後您可以獲得近實時搜索 - 這意味着更改會在幾秒鐘內反映出來。 – MJB 2012-02-16 17:57:04