本文整理汇总了Python中aleph.model.Document.all_ids方法的典型用法代码示例。如果您正苦于以下问题:Python Document.all_ids方法的具体用法?Python Document.all_ids怎么用?Python Document.all_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aleph.model.Document
的用法示例。
在下文中一共展示了Document.all_ids方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: foreign_id_exists
# 需要导入模块: from aleph.model import Document [as 别名]
# 或者: from aleph.model.Document import all_ids [as 别名]
def foreign_id_exists(self, source, foreign_id):
q = Document.all_ids().filter(Document.source_id == source.id)
q = q.filter(Document.foreign_id == foreign_id)
exists = q.first() is not None
if exists:
log.info("Foreign ID exists (%s): %s", source, foreign_id)
return exists
示例2: load_fixtures
# 需要导入模块: from aleph.model import Document [as 别名]
# 或者: from aleph.model.Document import all_ids [as 别名]
def load_fixtures(self, file_name, process_documents=True):
filepath = self.get_fixture_path(file_name)
load_fixtures(db, loaders.load(filepath))
db.session.commit()
if process_documents:
for doc_id, in Document.all_ids():
analyze_document(doc_id)
optimize_search()
示例3: load_fixtures
# 需要导入模块: from aleph.model import Document [as 别名]
# 或者: from aleph.model.Document import all_ids [as 别名]
def load_fixtures(self, file_name, process_documents=True):
filepath = os.path.abspath(os.path.join(FIXTURES, file_name))
load_fixtures(db, loaders.load(filepath))
db.session.commit()
if process_documents:
for doc_id, in Document.all_ids():
analyze_document(doc_id)
optimize_search()
示例4: index
# 需要导入模块: from aleph.model import Document [as 别名]
# 或者: from aleph.model.Document import all_ids [as 别名]
def index(foreign_id=None):
"""Index documents in the given source (or throughout)."""
q = Document.all_ids()
if foreign_id:
source = Source.by_foreign_id(foreign_id)
if source is None:
raise ValueError("No such source: %r" % foreign_id)
q = q.filter(Document.source_id == source.id)
for doc_id, in q:
index_document.delay(doc_id)
if foreign_id is None:
reindex_entities()
示例5: index
# 需要导入模块: from aleph.model import Document [as 别名]
# 或者: from aleph.model.Document import all_ids [as 别名]
def index(foreign_id=None):
"""Index documents in the given collection (or throughout)."""
q = Document.all_ids()
if foreign_id:
collection = Collection.by_foreign_id(foreign_id)
if collection is None:
raise ValueError("No such collection: %r" % foreign_id)
clause = Collection.id == collection.id
q = q.filter(Document.collections.any(clause))
for doc_id, in q:
index_document_id.delay(doc_id)
if foreign_id is None:
reindex_entities()