0

I'm indexing a sequence of documents with the IndexWriter and commiting the changes at the end of the iteration.

However, halfway the iteration I would like to "query" the uncommitted changes using an IndexSearcher. Is this possible with the current version of Lucene.Net ?

pelican_george
  • 961
  • 2
  • 13
  • 33

1 Answers1

1

Sure, you need a so-called near real-time reader do do that. You open such a reader by calling the IndexWriter.GetReader function:

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().

See the relevant blog post. It's for Java but applies to the .NET version as well.

Lucas Trzesniewski
  • 50,214
  • 11
  • 107
  • 158