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


Python RecordIndexer.delete_by_id方法代码示例

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


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

示例1: indexed_loans

# 需要导入模块: from invenio_indexer.api import RecordIndexer [as 别名]
# 或者: from invenio_indexer.api.RecordIndexer import delete_by_id [as 别名]
def indexed_loans(es, test_loans):
    """Get a function to wait for records to be flushed to index."""
    indexer = RecordIndexer()
    for pid, loan in test_loans:
        indexer.index(loan)
    current_search.flush_and_refresh(index="loans")

    yield test_loans

    for pid, loan in test_loans:
        indexer.delete_by_id(loan.id)
    current_search.flush_and_refresh(index="loans")
开发者ID:inveniosoftware,项目名称:invenio-circulation,代码行数:14,代码来源:conftest.py

示例2: remove_records

# 需要导入模块: from invenio_indexer.api import RecordIndexer [as 别名]
# 或者: from invenio_indexer.api.RecordIndexer import delete_by_id [as 别名]
def remove_records(app, record_ids):
    """Remove all records."""
    with app.app_context():
        indexer = RecordIndexer()
        for r_id in record_ids:
            record = RecordMetadata.query.get(r_id)
            indexer.delete_by_id(r_id)
            pids = PersistentIdentifier.query.filter_by(
                object_uuid=r_id).all()
            for pid in pids:
                db.session.delete(pid)
            db.session.delete(record)
        db.session.commit()
开发者ID:tiborsimko,项目名称:invenio-oaiserver,代码行数:15,代码来源:helpers.py


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