首页 新闻 会员 周边 捐助

Lucene.Net.Index.CorruptIndexException: invalid docCount: 2 maxDoc: 1

0
悬赏园豆:30 [已解决问题] 解决于 2023-02-22 16:48

通过 IndexWriter.UpdateDocument 更新文档在 IndexWriter.Commit 提交时报错 "invalid docCount"

Lucene.Net.Index.CorruptIndexException: invalid docCount: 2 maxDoc: 1 (resource=MMapIndexInput(path="/zzk/index/blogpost/_afj.cfs") [slice=_afj_Lucene41_0.tim])
   at Lucene.Net.Codecs.BlockTreeTermsReader..ctor(Directory dir, FieldInfos fieldInfos, SegmentInfo info, PostingsReaderBase postingsReader, IOContext ioContext, String segmentSuffix, Int32 indexDivisor)
   at Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.FieldsProducer(SegmentReadState state)
   at Lucene.Net.Codecs.PerField.PerFieldPostingsFormat.FieldsReader..ctor(SegmentReadState readState)
   at Lucene.Net.Index.SegmentCoreReaders..ctor(SegmentReader owner, Directory dir, SegmentCommitInfo si, IOContext context, Int32 termsIndexDivisor)
   at Lucene.Net.Index.SegmentReader..ctor(SegmentCommitInfo si, Int32 termInfosIndexDivisor, IOContext context)
   at Lucene.Net.Index.ReadersAndUpdates.GetReader(IOContext context)
   at Lucene.Net.Index.BufferedUpdatesStream.ApplyDeletesAndUpdates(ReaderPool readerPool, IList`1 infos)
   at Lucene.Net.Index.IndexWriter.ApplyAllDeletesAndUpdates()
   at Lucene.Net.Index.IndexWriter.MaybeApplyDeletes(Boolean applyAllDeletes)
   at Lucene.Net.Index.IndexWriter.PrepareCommitInternal()
   at Lucene.Net.Index.IndexWriter.CommitInternal()

请问如何解决?

dudu的主页 dudu | 高人七级 | 园豆:30755
提问于:2023-02-19 08:29

cfs 是 Compound File 的缩写

dudu 1年前
< >
分享
最佳答案
0

问题是并发更新索引引起的,改为以队列方式更新索引后问题就消失了,目前队列用的是 Coravel 的 IQueue,接下来准备基于 dapr 实现(本来就是订阅 dapr 消息更新索引的) https://q.cnblogs.com/q/142679/

dudu | 高人七级 |园豆:30755 | 2023-02-22 16:48
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册