internal static DirectoryIndexReader Open(Directory directory, bool closeDirectory, IndexDeletionPolicy deletionPolicy, IndexCommit commit, bool readOnly) { SegmentInfos.FindSegmentsFile finder = new AnonymousClassFindSegmentsFile(closeDirectory, deletionPolicy, directory, readOnly); if (commit == null) { return((DirectoryIndexReader)finder.Run()); } else { if (directory != commit.GetDirectory()) { throw new System.IO.IOException("the specified commit does not match the specified Directory"); } // this can and will directly throw IOException if the specified commit point has been deleted return((DirectoryIndexReader)finder.DoBody(commit.GetSegmentsFileName())); } }
internal static DirectoryIndexReader Open(Directory directory, bool closeDirectory, IndexDeletionPolicy deletionPolicy, IndexCommit commit, bool readOnly) { SegmentInfos.FindSegmentsFile finder = new AnonymousClassFindSegmentsFile(closeDirectory, deletionPolicy, directory, readOnly); if (commit == null) return (DirectoryIndexReader) finder.Run(); else { if (directory != commit.GetDirectory()) throw new System.IO.IOException("the specified commit does not match the specified Directory"); // this can and will directly throw IOException if the specified commit point has been deleted return (DirectoryIndexReader)finder.DoBody(commit.GetSegmentsFileName()); } }