コード例 #1
0
 def update_index(self):
     for entity_type in model.refs.TYPES:
         if hasattr(entity_type, "all"):
             for entity in entity_type.all():
                 index.update(entity)
     flash(_('Solr index updated.'), 'success')
     redirect(base_url('/admin'))
コード例 #2
0
ファイル: admin.py プロジェクト: alkadis/vcv
 def update_index(self):
     for entity_type in model.refs.TYPES:
         if hasattr(entity_type, "all"):
             for entity in entity_type.all():
                 index.update(entity)
     flash(_('Solr index updated.'), 'success')
     redirect(base_url('/admin'))
コード例 #3
0
ファイル: admin.py プロジェクト: rowanthorpe/adhocracy
 def update_index(self):
     for entity_type in model.refs.TYPES:
         if hasattr(entity_type, "all"):
             for entity in entity_type.all():
                 index.update(entity)
     flash(_("Solr index updated."), "success")
     redirect(base_url("/admin"))
コード例 #4
0
ファイル: __init__.py プロジェクト: AnonOnWarpath/adhocracy
def rebuild(classes):
    '''
    (Re)Index all entities of the given *classes*.
    '''
    start = time.time()
    done = 0
    connection = index.get_connection()
    for cls in classes:
        if cls not in INDEXED_CLASSES:
            log.warn('Class "%s" is not an indexable class! skipping.' % cls)
            continue
        log.info("Re-indexing %ss..." % cls.__name__)
        for entity in model.meta.Session.query(cls):
            index.update(entity, connection=connection, commit=False)
            done = done + 1
            if done % 100 == 0:
                connection.commit()
                log.info('indexed %d in %ss' % (done, time.time() - start))
    connection.commit()
    connection.close()
コード例 #5
0
ファイル: __init__.py プロジェクト: AnonOnWarpath/adhocracy
def rebuild(classes):
    '''
    (Re)Index all entities of the given *classes*.
    '''
    start = time.time()
    done = 0
    connection = index.get_connection()
    for cls in classes:
        if cls not in INDEXED_CLASSES:
            log.warn('Class "%s" is not an indexable class! skipping.' %
                     cls)
            continue
        log.info("Re-indexing %ss..." % cls.__name__)
        for entity in model.meta.Session.query(cls):
            index.update(entity, connection=connection, commit=False)
            done = done + 1
            if done % 100 == 0:
                connection.commit()
                log.info('indexed %d in %ss' % (done, time.time() - start))
    connection.commit()
    connection.close()