コード例 #1
0
ファイル: TestIsCurrent.cs プロジェクト: wwb/lucenenet
        public virtual void TestDeleteByTermIsCurrent()
        {
            // get reader
            DirectoryReader reader = Writer.Reader;

            // assert index has a document and reader is up2date
            Assert.AreEqual(1, Writer.NumDocs(), "One document should be in the index");
            Assert.IsTrue(reader.Current, "One document added, reader should be current");

            // remove document
            Term idTerm = new Term("UUID", "1");

            Writer.DeleteDocuments(idTerm);
            Writer.Commit();

            // assert document has been deleted (index changed), reader is stale
            Assert.AreEqual(0, Writer.NumDocs(), "Document should be removed");
            Assert.IsFalse(reader.Current, "Reader should be stale");

            reader.Dispose();
        }