将 Nhibernate.Search 与 Nhibernate 2 集成
我刚刚花了一整天的时间尝试让 NHibernate.Search 与 NHibernate 2.0 一起工作,很遗憾我还没有成功。 我遇到了此处发布的问题并下载了该帖子链接的 dll,但是示例使用搜索拦截器而不是事件监听器,我相信这是更新的处理方式。 可用的信息似乎很少,而且我能找到的信息很难理解并且与其他信息相矛盾。
此时我对整个事情感到非常沮丧,并且正在认真考虑编写自己的 Nhibernate 和 Lucene(或者可能是另一个索引库)集成。 目前看来 NHibernate.Search 还不够成熟,不足以让我考虑使用它,我会更舒服地维护自己的更简化的库。
我想知道是否有一种将 NHibernate.Search 与 NHibernate 2 一起使用的明确方法,以及在生产环境中使用它是否可行。
I have just spent all day attempting to get NHibernate.Search working alongside NHibernate 2.0 and am sorry to say that I have still not managed it. I ran into the problem posted here and downloaded the dll linked by that post, however the example uses a search Interceptor rather than EventListeners, which I believe to be the newer way of doing things. There seems to be very little information available and what I can find is difficult to understand and contradicts other pieces of information.
At this point I am pretty frustrated with the whole thing and am seriously considering just writing my own integration of Nhibernate and Lucene (or perhaps another indexing library). At the moment it seems that NHibernate.Search is nowehere near mature enough for me to consider using it, I would be far more comfortable maintaining my own rather more simplified library.
What I would like to know is if there is a definitive way of using NHibernate.Search with NHibernate 2 and whether it is feasible to use this in a production environment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了设置 EventListeners,您需要在初始化 NHibernate 时添加以下代码:
必须更改 web.config/app.config 文件以包含以下内容:
最后:当您创建 ISession 实例时,请记住使用此代码为了获得 IFullTextSession 。
这应该适用于 Lucene 2.0 和 NHibernate 2.0。
In order to setup EventListeners, you need to add this code when initializing NHibernate:
Your web.config/app.config file must be changed in order to include the following:
And finally: when you create an ISession instance, remember to use this code in order to get an IFullTextSession instead.
This should work with Lucene 2.0 and NHibernate 2.0.