server/checkintegrity.py
branchstable
changeset 6112 913979c79244
parent 5999 eaf8219f8b7d
child 6127 747e423093fc
equal deleted inserted replaced
6111:06c96a79c3c0 6112:913979c79244
    97     dbhelper = session.repo.system_source.dbhelper
    97     dbhelper = session.repo.system_source.dbhelper
    98     if not dbhelper.has_fti_table(cursor):
    98     if not dbhelper.has_fti_table(cursor):
    99         print 'no text index table'
    99         print 'no text index table'
   100         dbhelper.init_fti(cursor)
   100         dbhelper.init_fti(cursor)
   101     repo.system_source.do_fti = True  # ensure full-text indexation is activated
   101     repo.system_source.do_fti = True  # ensure full-text indexation is activated
   102     if withpb:
       
   103         pb = ProgressBar(len(etypes) + 1)
       
   104     if etypes is None:
   102     if etypes is None:
   105         print 'Reindexing entities'
   103         print 'Reindexing entities'
   106         etypes = set()
   104         etypes = set()
   107         for eschema in schema.entities():
   105         for eschema in schema.entities():
   108             if eschema.final:
   106             if eschema.final:
   121         session.system_sql("DELETE FROM %s WHERE EXISTS(SELECT 1 FROM ENTITIES "
   119         session.system_sql("DELETE FROM %s WHERE EXISTS(SELECT 1 FROM ENTITIES "
   122                            "WHERE eid=%s AND type IN (%s))" % (
   120                            "WHERE eid=%s AND type IN (%s))" % (
   123                                dbhelper.fti_table, dbhelper.fti_uid_attr,
   121                                dbhelper.fti_table, dbhelper.fti_uid_attr,
   124                                ','.join("'%s'" % etype for etype in etypes)))
   122                                ','.join("'%s'" % etype for etype in etypes)))
   125     if withpb:
   123     if withpb:
       
   124         pb = ProgressBar(len(etypes) + 1)
   126         pb.update()
   125         pb.update()
   127     # reindex entities by generating rql queries which set all indexable
   126     # reindex entities by generating rql queries which set all indexable
   128     # attribute to their current value
   127     # attribute to their current value
   129     source = repo.system_source
   128     source = repo.system_source
   130     for eschema in etypes:
   129     for eschema in etypes: