Nhibernate.Search 升级后的双 Lucene 索引目录

发布于 2024-08-17 14:38:34 字数 890 浏览 2 评论 0原文

我一直忙于将我们的 n* 堆栈升级到更新的版本。我们一直使用 FluentNhibernate 进行配置,并使用 Nhibernate.search 与 Lucene.Net 结合进行全文搜索。一切工作正常,直到我将库的各个版本更改为以下内容:

  • FluentNHibernate.dll:1.0.0.593
  • NHibernate.dll:2.1.0.4000
  • NHibernate.Search.dll:2.0.0.1001
  • Lucene.Net.dll:2.3.1.3

堆栈一直像以前一样工作,但我注意到一些奇怪的事情;之前 Lucene 索引目录为每个索引类包含一个子目录,而现在使用两个子目录,后缀为一个整数。

我们从

LuceneDirectory
.Class1
.Class2

LuceneDirectory
.Class1.0
.Class1.1
.Class2.0
.Class2.1

我稍微了解了 FluentNhibernate 的配置构建,发现对于每个映射,我创建了两个导入,一个带有映射的类的全名,一个没有(如果我映射“User”类,我将有一个映射和两个导入“POCOAssembly.User”和“User”)。这些目录是在 FullTextIndexEventListener 的初始化调用时创建的。

有没有人偶然发现同样的问题?我通读了 nhibernate.search 发行说明,但没有找到任何有关映射更改的信息;我有什么遗漏的吗?图书馆是否发生了重大变化?


编辑

我意识到指出我的映射类和映射源自用于审核目的的公共基础对象(创建日期/更新时间)可能很重要。

i've been busy upgrading our n* stack to a more recent version. We'd been using FluentNhibernate for configuration and Nhibernate.search coupled with Lucene.Net for full-text search. Everything worked fine until i changed the various versions of the libraries to the following:

  • FluentNHibernate.dll: 1.0.0.593
  • NHibernate.dll: 2.1.0.4000
  • NHibernate.Search.dll: 2.0.0.1001
  • Lucene.Net.dll: 2.3.1.3

The stack has been working as previously, but i noticed something strange; whereas before the Lucene index directory would contain one subdirectory for each indexed class, it's now using two subdirectories, suffixed by a integer.

We went from

LuceneDirectory
.Class1
.Class2

to

LuceneDirectory
.Class1.0
.Class1.1
.Class2.0
.Class2.1

I poked a bit around the configuration building of FluentNhibernate and found out that for each mapping, i have two imports created, one with the fullname of the class mapped, one without (if i map the "User" class, i'll have one mapping, and two imports "POCOAssembly.User", and "User"). The directories are created at the Initialize call of the FullTextIndexEventListener.

Has anyone stumbled upon the same problem? i read through the nhibernate.search release notes, but didn't find any info regarding a change in mappings; is there something i'm missing? Has there been a breaking change in the libraries?


Edit:

I realized it may be important to point out that my mapped classes and my mappings derive from a common base object used for auditing purposes (creation date/update time).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

↘紸啶 2024-08-24 14:38:34

我发现 NHibernate JIRA 中已报告该问题:https://nhibernate.jira。 com/browse/NHSR-22

发生的事情是我在 NHibernate 配置中设置了两个默认属性; “hibernate.search.default.directory_provider”和“hibernate.search.default.indexBase”
这些默认配置被视为两个分片,因为代码目前尚未经过测试。

一种解决方法是删除“hibernate.search.default.directory_provider”条目,因为它默认为正确的条目。

I found out that the problem has been reported in the NHibernate JIRA: https://nhibernate.jira.com/browse/NHSR-22

What happened is that i set two default properties in the NHibernate configuration; "hibernate.search.default.directory_provider" and "hibernate.search.default.indexBase"
These default configurations are considered as two shards, since the code hasn't been tested for the moment.

A workaround is to remove the "hibernate.search.default.directory_provider" entry as it defaults to the correct one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文