Lucene.NET 搜索时出现 ObjectDisposeException

发布于 2024-11-05 06:28:35 字数 2042 浏览 2 评论 0原文

我有一个使用 Lucene.Net 进行搜索的应用程序。
有一个 Windows 服务构建索引,然后 ASP.NET 应用程序创建一个 IndexSearcher 来搜索索引。

现在,在尝试进行搜索时,我不断收到以下堆栈跟踪/错误。我无法调试它,因为它部署在生产环境中。

System.ObjectDisposedException: Cannot access a closed file.
 at System.IO.__Error.FileNotOpen()
 at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)
 at Lucene.Net.Store.SimpleFSDirectory.SimpleFSIndexInput.ReadInternal(Byte[] b, Int32 offset, Int32 len)
 at Lucene.Net.Store.BufferedIndexInput.ReadBytes(Byte[] b, Int32 offset, Int32 len, Boolean useBuffer)
 at Lucene.Net.Index.CompoundFileReader.CSIndexInput.ReadInternal(Byte[] b, Int32 offset, Int32 len)
 at Lucene.Net.Store.BufferedIndexInput.Refill()
 at Lucene.Net.Store.BufferedIndexInput.ReadByte()
 at Lucene.Net.Store.IndexInput.ReadVInt()
 at Lucene.Net.Index.TermBuffer.Read(IndexInput input, FieldInfos fieldInfos) 
 at Lucene.Net.Index.SegmentTermEnum.Next()
 at Lucene.Net.Index.SegmentTermEnum.ScanTo(Term term) 
 at Lucene.Net.Index.TermInfosReader.Get(Term term, Boolean useCache) 
 at Lucene.Net.Index.TermInfosReader.Terms(Term term) 
 at Lucene.Net.Index.SegmentReader.Terms(Term t) 
 at Lucene.Net.Index.DirectoryReader.MultiTermEnum..ctor(IndexReader topReader, IndexReader[] readers, Int32[] starts, Term t) 
 at Lucene.Net.Index.DirectoryReader.Terms(Term term) 
 at Lucene.Net.Search.WildcardTermEnum..ctor(IndexReader reader, Term term) 
 at Lucene.Net.Search.WildcardQuery.GetEnum(IndexReader reader) 
 at Lucene.Net.Search.MultiTermQuery.ConstantScoreAutoRewrite.Rewrite(IndexReader reader, MultiTermQuery query) 
 at Lucene.Net.Search.MultiTermQuery.Rewrite(IndexReader reader) 
 at Lucene.Net.Search.WildcardQuery.Rewrite(IndexReader reader) 
 at Lucene.Net.Search.BooleanQuery.Rewrite(IndexReader reader) 
 at Lucene.Net.Search.IndexSearcher.Rewrite(Query original) 
 at Lucene.Net.Search.Query.Weight(Searcher searcher) 
 at Lucene.Net.Search.Searcher.CreateWeight(Query query) 
 at Lucene.Net.Search.Searcher.Search(Query query, Filter filter, Int32 n, Sort sort)

I have an application that uses Lucene.Net for searching.
There is a windows service that builds the index, and a ASP.NET application then creates an IndexSearcher to search the index.

Now I am constantly getting the following stack trace/error when attempting to do a search. I can't debug it because it is deployed on production.

System.ObjectDisposedException: Cannot access a closed file.
 at System.IO.__Error.FileNotOpen()
 at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)
 at Lucene.Net.Store.SimpleFSDirectory.SimpleFSIndexInput.ReadInternal(Byte[] b, Int32 offset, Int32 len)
 at Lucene.Net.Store.BufferedIndexInput.ReadBytes(Byte[] b, Int32 offset, Int32 len, Boolean useBuffer)
 at Lucene.Net.Index.CompoundFileReader.CSIndexInput.ReadInternal(Byte[] b, Int32 offset, Int32 len)
 at Lucene.Net.Store.BufferedIndexInput.Refill()
 at Lucene.Net.Store.BufferedIndexInput.ReadByte()
 at Lucene.Net.Store.IndexInput.ReadVInt()
 at Lucene.Net.Index.TermBuffer.Read(IndexInput input, FieldInfos fieldInfos) 
 at Lucene.Net.Index.SegmentTermEnum.Next()
 at Lucene.Net.Index.SegmentTermEnum.ScanTo(Term term) 
 at Lucene.Net.Index.TermInfosReader.Get(Term term, Boolean useCache) 
 at Lucene.Net.Index.TermInfosReader.Terms(Term term) 
 at Lucene.Net.Index.SegmentReader.Terms(Term t) 
 at Lucene.Net.Index.DirectoryReader.MultiTermEnum..ctor(IndexReader topReader, IndexReader[] readers, Int32[] starts, Term t) 
 at Lucene.Net.Index.DirectoryReader.Terms(Term term) 
 at Lucene.Net.Search.WildcardTermEnum..ctor(IndexReader reader, Term term) 
 at Lucene.Net.Search.WildcardQuery.GetEnum(IndexReader reader) 
 at Lucene.Net.Search.MultiTermQuery.ConstantScoreAutoRewrite.Rewrite(IndexReader reader, MultiTermQuery query) 
 at Lucene.Net.Search.MultiTermQuery.Rewrite(IndexReader reader) 
 at Lucene.Net.Search.WildcardQuery.Rewrite(IndexReader reader) 
 at Lucene.Net.Search.BooleanQuery.Rewrite(IndexReader reader) 
 at Lucene.Net.Search.IndexSearcher.Rewrite(Query original) 
 at Lucene.Net.Search.Query.Weight(Searcher searcher) 
 at Lucene.Net.Search.Searcher.CreateWeight(Query query) 
 at Lucene.Net.Search.Searcher.Search(Query query, Filter filter, Int32 n, Sort sort)

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

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

发布评论

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