hooks/syncschema.py
branchstable
changeset 4828 3e173d598cad
parent 4827 8a505bf12193
child 4829 3b79a0fc91db
child 4839 f482dbdf2f8c
equal deleted inserted replaced
4827:8a505bf12193 4828:3e173d598cad
  1153             rset = session.execute('Any X WHERE X is %s' % etype)
  1153             rset = session.execute('Any X WHERE X is %s' % etype)
  1154             self.info('Reindexing full text index for %i entity of type %s',
  1154             self.info('Reindexing full text index for %i entity of type %s',
  1155                       len(rset), etype)
  1155                       len(rset), etype)
  1156             still_fti = list(schema[etype].indexable_attributes())
  1156             still_fti = list(schema[etype].indexable_attributes())
  1157             for entity in rset.entities():
  1157             for entity in rset.entities():
  1158                 try:
  1158                 source.fti_unindex_entity(session, entity.eid)
  1159                     source.fti_unindex_entity(session, entity.eid)
  1159                 for container in entity.fti_containers():
  1160                     for container in entity.fti_containers():
  1160                     if still_fti or container is not entity:
  1161                         if still_fti or container is not entity:
  1161                         source.fti_unindex_entity(session, entity.eid)
  1162                             source.fti_unindex_entity(session, entity.eid)
  1162                         source.fti_index_entity(session, container)
  1163                             source.fti_index_entity(session, container)
       
  1164                 except Exception:
       
  1165                     self.critical('Error while updating Full Text Index for'
       
  1166                                   ' entity %s', entity.eid, exc_info=True)
       
  1167         if len(to_reindex):
  1163         if len(to_reindex):
  1168             # Transaction have already been committed
  1164             # Transaction have already been committed
  1169             session.pool.commit()
  1165             session.pool.commit()
  1170 
  1166 
  1171 
  1167