server/sources/native.py
changeset 10646 45671fb330f5
parent 10627 ffef8ac383f4
parent 10640 17bdc485c5b2
child 10651 9ca33768473c
child 11122 fedcb69982af
equal deleted inserted replaced
10645:57c60a96de70 10646:45671fb330f5
   930                                              (entity.eid, eschema_eid(cnx, eschema)))
   930                                              (entity.eid, eschema_eid(cnx, eschema)))
   931         if 'CWSource' in self.schema and source.eid is not None: # else, cw < 3.10
   931         if 'CWSource' in self.schema and source.eid is not None: # else, cw < 3.10
   932             self._handle_is_relation_sql(cnx, 'INSERT INTO cw_source_relation(eid_from,eid_to) VALUES (%s,%s)',
   932             self._handle_is_relation_sql(cnx, 'INSERT INTO cw_source_relation(eid_from,eid_to) VALUES (%s,%s)',
   933                                          (entity.eid, source.eid))
   933                                          (entity.eid, source.eid))
   934         # now we can update the full text index
   934         # now we can update the full text index
   935         if self.do_fti and self.need_fti_indexation(entity.cw_etype):
   935         if self.need_fti_indexation(entity.cw_etype):
   936             self.index_entity(cnx, entity=entity)
   936             self.index_entity(cnx, entity=entity)
   937 
   937 
   938     def update_info(self, cnx, entity, need_fti_update):
   938     def update_info(self, cnx, entity, need_fti_update):
   939         """mark entity as being modified, fulltext reindex if needed"""
   939         """mark entity as being modified, fulltext reindex if needed"""
   940         if self.do_fti and need_fti_update:
   940         if need_fti_update:
   941             # reindex the entity only if this query is updating at least
   941             # reindex the entity only if this query is updating at least
   942             # one indexable attribute
   942             # one indexable attribute
   943             self.index_entity(cnx, entity=entity)
   943             self.index_entity(cnx, entity=entity)
   944 
   944 
   945     def delete_info_multi(self, cnx, entities):
   945     def delete_info_multi(self, cnx, entities):
  1331 
  1331 
  1332     def index_entity(self, cnx, entity):
  1332     def index_entity(self, cnx, entity):
  1333         """create an operation to [re]index textual content of the given entity
  1333         """create an operation to [re]index textual content of the given entity
  1334         on commit
  1334         on commit
  1335         """
  1335         """
  1336         FTIndexEntityOp.get_instance(cnx).add_data(entity.eid)
  1336         if self.do_fti:
       
  1337             FTIndexEntityOp.get_instance(cnx).add_data(entity.eid)
  1337 
  1338 
  1338     def fti_unindex_entities(self, cnx, entities):
  1339     def fti_unindex_entities(self, cnx, entities):
  1339         """remove text content for entities from the full text index
  1340         """remove text content for entities from the full text index
  1340         """
  1341         """
  1341         cursor = cnx.cnxset.cu
  1342         cursor = cnx.cnxset.cu
  1721         sequences, numranges, tables, table_chunks = self.read_metadata(archive, backupfile)
  1722         sequences, numranges, tables, table_chunks = self.read_metadata(archive, backupfile)
  1722         for seq in sequences:
  1723         for seq in sequences:
  1723             self.logger.info('restoring sequence %s', seq)
  1724             self.logger.info('restoring sequence %s', seq)
  1724             self.read_sequence(archive, seq)
  1725             self.read_sequence(archive, seq)
  1725         for numrange in numranges:
  1726         for numrange in numranges:
  1726             self.logger.info('restoring numrange %s', seq)
  1727             self.logger.info('restoring numrange %s', numrange)
  1727             self.read_numrange(archive, numrange)
  1728             self.read_numrange(archive, numrange)
  1728         for table in tables:
  1729         for table in tables:
  1729             self.logger.info('restoring table %s', table)
  1730             self.logger.info('restoring table %s', table)
  1730             self.read_table(archive, table, sorted(table_chunks[table]))
  1731             self.read_table(archive, table, sorted(table_chunks[table]))
  1731         self.cnx.close()
  1732         self.cnx.close()