When my collection of files is updated then I want to search the newest data...
Like windows Advance search option.
When my collection of files is updated then I want to search the newest data...
Like windows Advance search option.
Yes, you can search and index at the same time. The only thing you need to consider is that when you open your IndexReader
, it basically takes a "snapshot" of the index: you need to close and reopen the IndexReader
to get any new updates (or call reopen
, which can be somewhat faster than closing and reopening).
From the Lucene FAQ:
Does Lucene allow searching and indexing simultaneously?
Yes. However, an IndexReader only searches the index as of the "point in time" that it was opened. Any updates to the index, either added or deleted documents, will not be visible until the IndexReader is re-opened. So your application must periodically re-open its IndexReaders to see the latest updates. The IndexReader.isCurrent() method allows you to test whether any updates have occurred to the index since your IndexReader was opened.
Admittedly that's a reference to the Java version, but I'd expect the .NET version to work the same way.