本文整理汇总了Python中lucene.IndexWriter.getConfig方法的典型用法代码示例。如果您正苦于以下问题:Python IndexWriter.getConfig方法的具体用法?Python IndexWriter.getConfig怎么用?Python IndexWriter.getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucene.IndexWriter
的用法示例。
在下文中一共展示了IndexWriter.getConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createIndex
# 需要导入模块: from lucene import IndexWriter [as 别名]
# 或者: from lucene.IndexWriter import getConfig [as 别名]
def createIndex(cls, dataDir, indexDir, useCompound):
indexDir = SimpleFSDirectory(File(indexDir))
config = IndexWriterConfig(Version.LUCENE_CURRENT,
StandardAnalyzer(Version.LUCENE_CURRENT))
config.setOpenMode(IndexWriterConfig.OpenMode.CREATE)
writer = IndexWriter(indexDir, config)
config = writer.getConfig()
mp = config.getMergePolicy()
if (LogMergePolicy.instance_(mp)):
mp.setUseCompoundFile(useCompound)
for dir, dirnames, filenames in os.walk(dataDir):
for filename in filenames:
if filename.endswith('.properties'):
cls.indexFile(writer, os.path.join(dir, filename), dataDir)
writer.commit()
writer.close()