我正在使用 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 目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!