NHibernate Search 是否会意识到底层数据的变化?

发布于 2024-12-28 17:21:48 字数 501 浏览 6 评论 0原文

我在网上看到过一些说法,大意是 NHibernate(或 Hibernate)搜索“负责数据库/索引同步”。

当我读到这些陈述时,我不禁想知道是否有一个隐含的“...只要您使用 [N]Hibernate 进行任何和所有数据访问。”

我正在使用 NHibernate 作为针对完全由不同应用程序拥有的数据库的只读数据访问层 - 因此我的应用程序将永远直接了解外部写入。

Hibernate/NHibernate Search 实际上是否会执行任何操作来监视原始数据的更改,例如设置查询通知和/或在整个或部分索引上使用生存时间或“过期”?

或者,随着越来越多的行被外部应用程序更改,Lucene 索引是否会随着时间的推移而逐渐变得陈旧?

如果这个工具执行这种同步,那么除了手动重新索引(这将非常难以正确计时)之外,我还能做些什么吗保持 Lucene 索引与数据库同步,或者我最好只使用 SQL Server 中的全文功能,就像我到目前为止一直在做的那样?

I've seen several statements online to the effect that NHibernate (or Hibernate) Search "takes care of the database/index synchronization".

When I read these statements, I cannot help but wonder if there is an implied "...as long as you use [N]Hibernate for any and all data access."

I am using NHibernate as a read-only data access layer against a database that is owned entirely by a different application - so my application will never be directly aware of external writes.

Does Hibernate/NHibernate Search actually do anything to monitor changes to the raw data, as in setting up a query notification and/or employing a time-to-live or "expiration" on whole or partial indexes?

Or is the Lucene index just going to get progressively staler over time as more and more rows are changed by external applications?

If this tool doesn't do that kind of synchronization, then aside from manual reindexing (which would be very difficult to time properly), is there anything else I can do to keep the Lucene index in sync with the database, or am I better off just using the Fulltext capabilities in SQL Server, as I have been doing up until this point?

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

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

发布评论

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

评论(1

泛泛之交 2025-01-04 17:21:48

我想我已经能够从 Hibernate 搜索文档

Hibernate Search 将透明地索引通过 Hibernate Core 保存、更新或删除的每个实体。但是,您必须为数据库中已有的数据创建一个初始 Lucene 索引。

如果您必须创建一个初始索引,那么如果在应用程序外部进行任何更改,您也必须更新该索引,这是理所当然的。

显然,HS/NHS 并不是像 SQL Server FTS、Oracle Text 等那样的即发即忘解决方案,除非几乎所有数据写入都是通过会话完成的。

I think I've been able to infer the answer from the Hibernate Search Documentation:

Hibernate Search will transparently index every entity persisted, updated or removed through Hibernate Core. However, you have to create an initial Lucene index for the data already present in your database.

If you have to create an initial index then it stands to reason that you'll also have to update that index if any changes are made outside the application.

Evidently, HS/NHS is not a fire-and-forget solution like SQL Server FTS, Oracle Text, etc., unless pretty much all data writes are done through the session.

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