本文整理汇总了Python中org.apache.lucene.index.DirectoryReader.listCommits方法的典型用法代码示例。如果您正苦于以下问题:Python DirectoryReader.listCommits方法的具体用法?Python DirectoryReader.listCommits怎么用?Python DirectoryReader.listCommits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.index.DirectoryReader
的用法示例。
在下文中一共展示了DirectoryReader.listCommits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testIndexDeletionPolicy
# 需要导入模块: from org.apache.lucene.index import DirectoryReader [as 别名]
# 或者: from org.apache.lucene.index.DirectoryReader import listCommits [as 别名]
def testIndexDeletionPolicy(self):
writer = self.getWriter()
# no commits exist in the index yet
self.assertTrue(self.policy.onInitCalled)
# we haven't called commit yet
self.assertFalse(self.policy.onCommitCalled)
doc = Document()
writer.addDocument(doc)
writer.commit()
# now we called commit
self.assertTrue(self.policy.onCommitCalled)
# external IR sees 1 commit:
self.assertEquals(1, DirectoryReader.listCommits(self.directory).size())
# commit again:
writer.addDocument(doc)
writer.commit()
# external IR sees 2 commits:
self.assertEquals(2, DirectoryReader.listCommits(self.directory).size())
writer.close()
# open same index, make sure both commits survived:
writer = self.getWriter()
self.assertTrue(self.policy.onInitCalled)
self.assertFalse(self.policy.onCommitCalled)
self.assertEquals(2, DirectoryReader.listCommits(self.directory).size())
writer.close()
# 3 from closing writer again
self.assertEquals(3, DirectoryReader.listCommits(self.directory).size())