Lucene.net 3.0.5 - 可以读取未提交的更改吗?
Lucene.net 3.0.5 - Reading uncommited changes, possible?
我正在使用 IndexWriter 为一系列文档编制索引,并在迭代结束时提交更改。
但是,在迭代进行到一半时,我想 "query" 使用 IndexSearcher 进行未提交的更改。当前版本的 Lucene.Net 是否可行?
当然,您需要 so-called near real-time reader 这样做。你通过调用IndexWriter.GetReader
函数打开这样一个reader:
returns a readonly reader, covering all committed as well as un-committed changes to the index. This provides "near real-time" searching, in that changes made during an IndexWriter
session can be quickly made available for searching without closing the writer nor calling Commit()
.
见相关blog post。它适用于 Java,但也适用于 .NET 版本。
我正在使用 IndexWriter 为一系列文档编制索引,并在迭代结束时提交更改。
但是,在迭代进行到一半时,我想 "query" 使用 IndexSearcher 进行未提交的更改。当前版本的 Lucene.Net 是否可行?
当然,您需要 so-called near real-time reader 这样做。你通过调用IndexWriter.GetReader
函数打开这样一个reader:
returns a readonly reader, covering all committed as well as un-committed changes to the index. This provides "near real-time" searching, in that changes made during an
IndexWriter
session can be quickly made available for searching without closing the writer nor callingCommit()
.
见相关blog post。它适用于 Java,但也适用于 .NET 版本。