hooks/syncschema.py
branchstable
changeset 6889 37668bf302f5
parent 6815 a84190d4e78c
child 6954 f9a84d54ebf3
equal deleted inserted replaced
6888:c02e5ba43366 6889:37668bf302f5
  1210             rset = session.execute('Any X WHERE X is %s' % etype)
  1210             rset = session.execute('Any X WHERE X is %s' % etype)
  1211             self.info('Reindexing full text index for %i entity of type %s',
  1211             self.info('Reindexing full text index for %i entity of type %s',
  1212                       len(rset), etype)
  1212                       len(rset), etype)
  1213             still_fti = list(schema[etype].indexable_attributes())
  1213             still_fti = list(schema[etype].indexable_attributes())
  1214             for entity in rset.entities():
  1214             for entity in rset.entities():
  1215                 source.fti_unindex_entity(session, entity.eid)
  1215                 source.fti_unindex_entities(session, [entity])
  1216                 for container in entity.cw_adapt_to('IFTIndexable').fti_containers():
  1216                 for container in entity.cw_adapt_to('IFTIndexable').fti_containers():
  1217                     if still_fti or container is not entity:
  1217                     if still_fti or container is not entity:
  1218                         source.fti_unindex_entity(session, container.eid)
  1218                         source.fti_unindex_entities(session, [container])
  1219                         source.fti_index_entity(session, container)
  1219                         source.fti_index_entities(session, [container])
  1220         if to_reindex:
  1220         if to_reindex:
  1221             # Transaction has already been committed
  1221             # Transaction has already been committed
  1222             session.pool.commit()
  1222             session.pool.commit()
  1223 
  1223 
  1224 
  1224