Lucene索引在添加文档时被删除

发布于 2025-01-28 13:05:12 字数 670 浏览 2 评论 0原文

我正在使用lucene.net。

在某些客户的计算机上,当我们尝试添加新文档时,所有索引都将被删除。

流程:

  1. 检查文档是否已经存在,
  2. 如果存在删除,
  3. 请添加新文档

说我有2000个索引,现在添加了新的索引,它删除了所有索引文档,并且只是保留了我们最近添加的文档。但是,几次也删除了这一点。

它仅在少数客户的机器上发生,我们也无法在环境上复制。

var dir = new DirectoryInfo(_reportIndexDirectory);
 _directory = FSDirectory.Open(dir);
 _ireader = IndexReader.Open(_directory, true);

_iwriter = new IndexWriter(_directory, _analyzer, (!dir.Exists ||     dir.GetFiles().Length == 0) ? true : false, IndexWriter.MaxFieldLength.LIMITED);
 _iwriter.SetMaxFieldLength(25000);
 _iwriter.SetSimilarity(_similarityOne);
 _iwriter.SetRAMBufferSizeMB(900);

I am using Lucene.Net.

On some clients' machines all the indexes are getting deleted when we are trying to add a new document.

Process:

  1. Check if document already exists
  2. If Exists delete
  3. Else add a new document

Say I had 2000 indexes, now adding new one, it deletes all the indexed documents and just keeps the one which we have added recently. However, a few times it also deletes that.

It is only happening on a few customers' machines and we are also not able to reproduce on our environment.

var dir = new DirectoryInfo(_reportIndexDirectory);
 _directory = FSDirectory.Open(dir);
 _ireader = IndexReader.Open(_directory, true);

_iwriter = new IndexWriter(_directory, _analyzer, (!dir.Exists ||     dir.GetFiles().Length == 0) ? true : false, IndexWriter.MaxFieldLength.LIMITED);
 _iwriter.SetMaxFieldLength(25000);
 _iwriter.SetSimilarity(_similarityOne);
 _iwriter.SetRAMBufferSizeMB(900);

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文