public void ReadSegmentsGenTest() { // check the generation in the directory IndexReader reader = IndexReader.Open(this.directory, true); IndexCommit commit = reader.GetIndexCommit(); // create a SegmentsGenCommit SegmentsGenCommit sgCommit = new SegmentsGenCommit(this.directory); Assert.AreEqual(commit.GetGeneration(), sgCommit.GetGeneration()); Assert.AreEqual(commit.GetSegmentsFileName(), sgCommit.GetSegmentsFileName()); }
public void OpenWriterWithCommit() { SegmentsGenCommit sgCommit = new SegmentsGenCommit(this.directory); IndexWriter writer = new IndexWriter(this.directory, new WhitespaceAnalyzer(), null, IndexWriter.MaxFieldLength.UNLIMITED, sgCommit); Assert.AreEqual(10, writer.MaxDoc()); IndexReader reader = writer.GetReader(); IndexCommit commit = reader.GetIndexCommit(); Assert.AreEqual(commit.GetGeneration(), sgCommit.GetGeneration()); Assert.AreEqual(commit.GetSegmentsFileName(), sgCommit.GetSegmentsFileName()); }