Lucene.NET - 在服务器关闭时获取损坏的索引

发布于 2024-11-29 09:31:01 字数 280 浏览 0 评论 0 原文

因此,除了偶尔出现的索引损坏之外,我对当前站点上的 Lucene.NET 实现非常满意。我不会收到任何错误,但我会开始注意到返回的结果是两倍、三倍等。如果我使用 Luke 我会发现索引有些奇怪,很多文档多次出现。所以我想也许终结器/Dispose 没有被调用,因此这会损坏索引?

有人有防止这种情况发生的经验吗?我知道如果我手动从磁盘删除索引文件,一切都会恢复正常。我应该在每次服务重新启动时尝试执行此操作吗?

So I'm very happy with the Lucene.NET implementation on a current site other than the odd occasional index corruption. I won't get any errors but I'll start noticing results coming back double, triple, etc. If I use Luke I'll see oddness with the index, lots of documents showing up multiple times. So I'm thinking that maybe the finalizer / Dispose isn't being called and thus this corrupts the indices?

Anyone have any experience preventing this from happening? I know that if I manually delete the index files from disk that everything returns to normal. Should I be trying to do that on each service restart?

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

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

发布评论

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

评论(3

一杯敬自由 2024-12-06 09:31:01

嗯,这听起来不像索引损坏,但听起来确实像是您可能在索引中输入了重复的文档。

文档是如何放置在索引中的?是否有一个字段被用作主键?添加文档时如何检查此键?您是否一次性添加所有文档并且从不更新它们?或者您检查更新并稍后更新。

从测试的角度来看,也许最有趣的是,一旦服务关闭,您是否会得到一组明显一致的重复项?这确实不会表明索引损坏,不是吗?

祝你好运,

Hmmm, this doesn't sound like index corruption, but it does sound like you might be entering duplicate documents into your index.

How are documents being placed in your index? Is there a field that's being used as a primary key? How are you checking against this key when adding documents? Do you add all your documents in one pass and never update them? Or do you check for updates and update later.

Perhaps most interesting from a testing point of view, do you end up with an apparently consistent set of duplicates once the service has been shut down? That really wouldn't point to an index corruption, would it?

Good luck,

幸福还没到 2024-12-06 09:31:01

解决方案最终是使用 索引编写器构造函数重载,允许指定应重新创建索引。这将删除旧的索引文件。 这个问题帮助我指明了正确的方向。

The solution ended up being to use the indexwriter constructor overload that allows one to specify that the indices should be recreated. This deletes the old index files. This SO question helped point me in the right direction.

风向决定发型 2024-12-06 09:31:01

我有类似的问题,如果操作系统带有 blusescreen,lucene 索引可能会损坏。
我猜想,也许某些 lucene 索引更新正在操作系统级别写入磁盘,并且操作系统出现了蓝屏,然后使索引损坏。

I have similar issue, if OS gone with blusescreen, the lucene index may corrupt.
I guess, maybe some lucene index update is writing to disk in OS level's, and OS gone blusescreen, then make the index corrupted.

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