private IndexReader DoReopenFromWriter(bool openReadOnly, IndexCommit commit)
{
System.Diagnostics.Debug.Assert(readOnly);
if (!openReadOnly)
{
throw new System.ArgumentException("a reader obtained from IndexWriter.getReader() can only be reopened with openReadOnly=true (got false)");
}
if (commit != null)
{
throw new System.ArgumentException("a reader obtained from IndexWriter.getReader() cannot currently accept a commit");
}
// TODO: right now we *always* make a new reader; in
// the future we could have write make some effort to
// detect that no changes have occurred
return writer.GetReader();
}