Lucene索引在添加文档时被删除
我正在使用lucene.net。
在某些客户的计算机上,当我们尝试添加新文档时,所有索引都将被删除。
流程:
- 检查文档是否已经存在,
- 如果存在删除,
- 请添加新文档
说我有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:
- Check if document already exists
- If Exists delete
- 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论