当前位置: 首页>>代码示例>>Python>>正文


Python Index.create方法代码示例

本文整理汇总了Python中index.Index.create方法的典型用法代码示例。如果您正苦于以下问题:Python Index.create方法的具体用法?Python Index.create怎么用?Python Index.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在index.Index的用法示例。


在下文中一共展示了Index.create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_index_file

# 需要导入模块: from index import Index [as 别名]
# 或者: from index.Index import create [as 别名]
def test_index_file():
    dir = './test_index'
    idx = Index.create(dir)
    writer = idx.get_writer()
    writer.add_document(
        path = u'/foo/bar',
        title = u'Foo: The History',
        last_modified = 34343423423,
        text = u'Not much to say here')
    writer.commit()
    assert idx.doc_count() == 1
开发者ID:timjstewart,项目名称:dexter,代码行数:13,代码来源:index_test.py

示例2: createIndex

# 需要导入模块: from index import Index [as 别名]
# 或者: from index.Index import create [as 别名]
 def createIndex(self, name, col): 
     """ Create an index on the table.
     Arguments:
     name -- name of the index, used to identify it
     col -- name of column to be used as key for the index
     """
 
     index = Index.create(name, col)
     self.indexes.append(index)
     for row in self.rows:
         index.insert(row)
开发者ID:heikkiv,项目名称:trak,代码行数:13,代码来源:table.py

示例3: test_documents_found_by_title

# 需要导入模块: from index import Index [as 别名]
# 或者: from index.Index import create [as 别名]
def test_documents_found_by_title():
    idx = Index.create('./test_index')
    indexer = DirectoryIndexer(idx)
    indexer.index_directory('./tests/sample_files')
    searcher = Searcher(idx)
    assert 1 == len(searcher.find_by_title(u'one'))
开发者ID:timjstewart,项目名称:dexter,代码行数:8,代码来源:searcher_test.py

示例4: test_documents_found_by_full_text

# 需要导入模块: from index import Index [as 别名]
# 或者: from index.Index import create [as 别名]
def test_documents_found_by_full_text():
    idx = Index.create('./test_index')
    indexer = DirectoryIndexer(idx)
    indexer.index_directory('./tests/sample_files')
    searcher = Searcher(idx)
    assert 2 == len(searcher.find_by_full_text(u'Funny'))
开发者ID:timjstewart,项目名称:dexter,代码行数:8,代码来源:searcher_test.py

示例5: test_documents_added

# 需要导入模块: from index import Index [as 别名]
# 或者: from index.Index import create [as 别名]
def test_documents_added():
    idx = Index.create('./test_index')
    indexer = DirectoryIndexer(idx)
    indexer.index_directory('./tests/sample_files')
    assert idx.doc_count() == 3
开发者ID:timjstewart,项目名称:dexter,代码行数:7,代码来源:indexer_test.py

示例6: test_index_exists

# 需要导入模块: from index import Index [as 别名]
# 或者: from index.Index import create [as 别名]
def test_index_exists():
    dir = './test_index'
    Index.create(dir)
    assert Index.exists(dir)
开发者ID:timjstewart,项目名称:dexter,代码行数:6,代码来源:index_test.py

示例7: test_new_index_has_zero_documents

# 需要导入模块: from index import Index [as 别名]
# 或者: from index.Index import create [as 别名]
def test_new_index_has_zero_documents():
    dir = './test_index'
    idx = Index.create(dir)
    assert idx.doc_count() == 0
开发者ID:timjstewart,项目名称:dexter,代码行数:6,代码来源:index_test.py


注:本文中的index.Index.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。