問題描述
我正在使用 Lucene 3.5.0 在我的網站上做一些基本的搜索工作.我想將索引存儲在 Mysql 數據庫的 JDBC 目錄中.我打算使用 Compass 項目來執行此操作,但經過更多研究并實際嘗試了代碼,我發現 Compass 是一個死項目,它不再與當前版本的 Lucene 兼容.
I am using Lucene 3.5.0 to do some basic search stuff on my website. I want to store the index in a JDBC Directory in my Mysql Database. I was going to use the Compass Project to do this, but with some more research and actually trying the code I have found that Compass is a dead project and it no longer is compatible with the current version of Lucene.
還有其他選項可以將我的索引存儲在 JDBC 目錄中嗎?Lucene 不提供這個原生是有原因的嗎?出于某種原因,在 HDD 上存儲是更好的選擇嗎?
Is there another option to store my index in a JDBC Directory? Is there a reason Lucene does not offer this native? Is storing on the HDD a better option for some reason?
推薦答案
來自 常見問題解答:
Lucene 不支持開箱即用的功能,但有幾個人實現了 JdbcDirectory 的.到目前為止,我們看到的報告表明,這種實現的性能不是很好,但它是可行的.
Lucene does not support that functionality out of the box, but several people have implemented JdbcDirectory's. The reports we have seen so far indicate that performance with such implementations is not great, but it is doable.
另一種方法是將索引作為 BLOB 存儲在數據庫中,如果您有多個節點運行您的應用程序,這可能會很有用.如果為 BLOB 添加時間戳,每個節點都可以檢查索引是否已更新并從數據庫中重新創建索引文件.
Another approach would be to store the index in the database as a BLOB, this could be useful if you have multiple nodes running your application. If you add a timestamp to the BLOB each node could check whether the index has been updated and recreate the index file from the DB.
這篇關于Lucene JDBC 目錄的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!