def analyze_collection(collection_id): """Re-analyze the elements of this collection, documents and entities.""" q = db.session.query(Collection).filter(Collection.id == collection_id) collection = q.first() if collection is None: log.error("No collection with ID: %r", collection_id) # re-process the documents analyze_documents(collection.id) # re-process entities for entity in collection.entities: update_entity_full(entity.id)
def process_collection(collection_id): """Re-analyze the elements of this collection, documents and entities.""" q = db.session.query(Collection).filter(Collection.id == collection_id) collection = q.first() if collection is None: log.error("No collection with ID: %r", collection_id) # re-process the documents q = db.session.query(Document) q = q.filter(Document.collection_id == collection_id) q = q.filter(Document.parent_id == None) # noqa for document in q: ingest.apply_async([document.id], priority=1) # re-process entities q = db.session.query(Entity) q = q.filter(Entity.collection_id == collection.id) for entity in q: update_entity_full(entity.id) update_collection(collection)