def handle(self, *args, **options): qs = AbstractCreativeWork.objects.annotate(has_identifiers=Exists( WorkIdentifier.objects.filter( creative_work=OuterRef('pk')))).exclude(has_identifiers=True) indexer = SearchIndexer(celery_app) for id in qs.values_list('id', flat=True).iterator(): indexer.index('creativework', id)
def reindex_works(works, index=None, urgent=True): if not isinstance(works, list): works = [works] work_ids = [work.id for work in works] if (work_ids): print('Indexing {} works'.format(len(work_ids))) indexer = SearchIndexer() indexer.index('creativework', *work_ids, index=index, urgent=urgent) else: print('No works to index')
def handle(self, *args, **options): qs = AbstractCreativeWork.objects.annotate( has_identifiers=Exists( WorkIdentifier.objects.filter(creative_work=OuterRef('pk')) ) ).exclude(has_identifiers=True) indexer = SearchIndexer(celery_app) for id in qs.values_list('id', flat=True).iterator(): indexer.index('creativework', id)
def _update_index(self, work_ids, urgent): indexer = SearchIndexer( self.task.app) if self.task else SearchIndexer() indexer.index('creativework', *work_ids, urgent=urgent)
def _update_index(self, work_ids, urgent): indexer = SearchIndexer(self.task.app) if self.task else SearchIndexer() indexer.index('creativework', *work_ids, urgent=urgent)