Refreshes an IndexReader if the index has changed since this instance
was (re)opened.
Opening an IndexReader is an expensive operation. This method can be used
to refresh an existing IndexReader to reduce these costs. This method
tries to only load segments that have changed or were created after the
IndexReader was (re)opened.
If the index has not changed since this instance was (re)opened, then this
call is a NOOP and returns this instance. Otherwise, a new instance is
returned. The old instance is not closed and remains usable.
If the reader is reopened, even though they share resources internally, it's safe to make changes (deletions, norms) with the new reader. All shared mutable state obeys "copy on write" semantics to ensure the changes are not seen by other readers. You can determine whether a reader was actually reopened by comparing the old instance with the instance returned by this method:
Namespace: Lucene.Net.IndexIf the reader is reopened, even though they share resources internally, it's safe to make changes (deletions, norms) with the new reader. All shared mutable state obeys "copy on write" semantics to ensure the changes are not seen by other readers. You can determine whether a reader was actually reopened by comparing the old instance with the instance returned by this method:
IndexReader reader = ... ... IndexReader newReader = r.reopen(); if (newReader != reader) { ... // reader was reopened reader.close(); } reader = newReader; ...Be sure to synchronize that code so that other threads, if present, can never use reader after it has been closed and before it's switched to newReader. NOTE: If this reader is a near real-time reader (obtained from {@link IndexWriter#GetReader()}, reopen() will simply call writer.getReader() again for you, though this may change in the future.
Assembly: Lucene.Net (in Lucene.Net.dll) Version: 2.9.4.1
Syntax
C# |
---|
public virtual IndexReader Reopen() |
Visual Basic |
---|
Public Overridable Function Reopen As IndexReader |
Visual C++ |
---|
public: virtual IndexReader^ Reopen() |
Return Value
[Missing <returns> documentation for "M:Lucene.Net.Index.IndexReader.Reopen"]