コード例 #1
0
ファイル: tasks.py プロジェクト: vaishalitekale/kuma
def render_done_handler(**kwargs):
    if not settings.ES_LIVE_INDEX or 'instance' not in kwargs:
        return
    instance = kwargs['instance']
    try:
        index_objects.delay(instance.get_mapping_type(), [instance.id])
    except:
        logging.error('Search indexing task failed', exc_info=True)
コード例 #2
0
ファイル: tasks.py プロジェクト: AprilMorone/kuma
def render_done_handler(**kwargs):
    if not settings.ES_LIVE_INDEX or 'instance' not in kwargs:
        return
    instance = kwargs['instance']
    try:
        index_objects.delay(instance.get_mapping_type(), [instance.id])
    except:
        logging.error('Search indexing task failed',
                      exc_info=True)
コード例 #3
0
ファイル: tasks.py プロジェクト: Arveti/kuma
def render_done_handler(**kwargs):
    if not settings.ES_LIVE_INDEX or 'instance' not in kwargs:
        return
    instance = kwargs['instance']
    mappping_type = instance.get_mapping_type()
    if mappping_type.should_update(instance):
        try:
            index_objects.delay(mappping_type, [instance.id])
        except:
            logging.error('Search indexing task failed',
                          exc_info=True)
    else:
        logging.info('Ignoring wiki document %r while updating search index',
                     instance.id, exc_info=True)
コード例 #4
0
ファイル: models.py プロジェクト: ninadg/kuma
 def promote(self):
     rescheduled = []
     for outdated_object in self.outdated_objects.all():
         instance = outdated_object.content_object
         label = ('%s.%s.%s' %
                  (outdated_object.content_type.natural_key() +
                   (instance.id,)))  # gives us 'wiki.document.12345'
         if label in rescheduled:
             continue
         mappping_type = instance.get_mapping_type()
         index_objects.delay(mappping_type, [instance.id])
         rescheduled.append(label)
     self.outdated_objects.all().delete()
     self.promoted = True
     self.save()
コード例 #5
0
 def promote(self):
     rescheduled = []
     for outdated_object in self.outdated_objects.all():
         instance = outdated_object.content_object
         label = ('%s.%s.%s' % (outdated_object.content_type.natural_key() +
                                (instance.id, ))
                  )  # gives us 'wiki.document.12345'
         if label in rescheduled:
             continue
         mappping_type = instance.get_mapping_type()
         index_objects.delay(mappping_type, [instance.id])
         rescheduled.append(label)
     self.outdated_objects.all().delete()
     self.promoted = True
     self.save()
コード例 #6
0
ファイル: models.py プロジェクト: samucc/kuma
 def promote(self):
     rescheduled = []
     for outdated_object in self.outdated_objects.all():
         instance = outdated_object.content_object
         label = ('%s.%s.%s' % (outdated_object.content_type.natural_key() +
                                (instance.id, ))
                  )  # gives us 'wiki.document.12345'
         if label in rescheduled:
             continue
         mapping_type = instance.get_document_type()
         index_objects.delay(mapping_type, [instance.id])
         rescheduled.append(label)
     self.outdated_objects.all().delete()
     self.promoted = True
     self.save()
     # Allow only a single index to be promoted.
     Index.objects.exclude(pk=self.pk).update(promoted=False)
コード例 #7
0
ファイル: signals.py プロジェクト: lmorchard/kuma
def render_done_handler(**kwargs):
    if not settings.ES_LIVE_INDEX or 'instance' not in kwargs:
        return
    from .models import Index
    instance = kwargs['instance']
    mappping_type = instance.get_mapping_type()
    if mappping_type.should_update(instance):
        current_index = Index.objects.get_current()
        outdated = current_index.record_outdated(instance)
        if outdated:
            log.info('Found a newer index and scheduled '
                     'indexing it after promotion.')
        try:
            index_objects.delay(mappping_type, [instance.id])
        except:
            log.error('Search indexing task failed', exc_info=True)
    else:
        log.info('Ignoring wiki document %r while updating search index',
                 instance.id, exc_info=True)
コード例 #8
0
ファイル: signals.py プロジェクト: Faldrian/kuma
def render_done_handler(**kwargs):
    if not settings.ES_LIVE_INDEX or 'instance' not in kwargs:
        return
    from .models import Index
    doc = kwargs['instance']
    mappping_type = doc.get_mapping_type()
    if mappping_type.should_update(doc):
        current_index = Index.objects.get_current()
        outdated = current_index.record_outdated(doc)
        if outdated:
            log.info('Found a newer index and scheduled '
                     'indexing it after promotion.')
        doc_pks = set(doc.other_translations.values_list('pk', flat=True))
        doc_pks.add(doc.id)
        try:
            index_objects.delay(mappping_type, list(doc_pks))
        except:
            log.error('Search indexing task failed', exc_info=True)
    else:
        log.info('Ignoring wiki document %r while updating search index',
                 doc.id, exc_info=True)
コード例 #9
0
def render_done_handler(**kwargs):
    if not settings.ES_LIVE_INDEX or 'instance' not in kwargs:
        return
    from .models import Index
    doc = kwargs['instance']
    mappping_type = doc.get_mapping_type()
    if mappping_type.should_update(doc):
        current_index = Index.objects.get_current()
        outdated = current_index.record_outdated(doc)
        if outdated:
            log.info('Found a newer index and scheduled '
                     'indexing it after promotion.')
        doc_pks = set(doc.other_translations.values_list('pk', flat=True))
        doc_pks.add(doc.id)
        try:
            index_objects.delay(mappping_type, list(doc_pks))
        except:
            log.error('Search indexing task failed', exc_info=True)
    else:
        log.info('Ignoring wiki document %r while updating search index',
                 doc.id,
                 exc_info=True)