server/sources/native.py
branchstable
changeset 3497 63b9541dd36f
parent 3240 8604a15995d1
child 3503 06bced8edddf
child 3689 deb13e88e037
equal deleted inserted replaced
3496:35a67ac6efe8 3497:63b9541dd36f
   552         """remove text content for entity with the given eid from the full text
   552         """remove text content for entity with the given eid from the full text
   553         index
   553         index
   554         """
   554         """
   555         try:
   555         try:
   556             self.indexer.cursor_unindex_object(eid, session.pool['system'])
   556             self.indexer.cursor_unindex_object(eid, session.pool['system'])
   557         except:
   557         except Exception: # let KeyboardInterrupt / SystemExit propagate
   558             if self.indexer is not None:
   558             if self.indexer is not None:
   559                 self.exception('error while unindexing %s', eid)
   559                 self.exception('error while unindexing %s', eid)
   560 
   560 
   561     def fti_index_entity(self, session, entity):
   561     def fti_index_entity(self, session, entity):
   562         """add text content of a created/modified entity to the full text index
   562         """add text content of a created/modified entity to the full text index
   563         """
   563         """
   564         self.info('reindexing %r', entity.eid)
   564         self.info('reindexing %r', entity.eid)
   565         try:
   565         try:
   566             self.indexer.cursor_reindex_object(entity.eid, entity,
   566             self.indexer.cursor_reindex_object(entity.eid, entity,
   567                                                session.pool['system'])
   567                                                session.pool['system'])
   568         except:
   568         except Exception: # let KeyboardInterrupt / SystemExit propagate
   569             if self.indexer is not None:
   569             if self.indexer is not None:
   570                 self.exception('error while reindexing %s', entity)
   570                 self.exception('error while reindexing %s', entity)
   571         # update entities.mtime
   571         # update entities.mtime
   572         attrs = {'eid': entity.eid, 'mtime': datetime.now()}
   572         attrs = {'eid': entity.eid, 'mtime': datetime.now()}
   573         session.system_sql(self.sqlgen.update('entities', attrs, ['eid']), attrs)
   573         session.system_sql(self.sqlgen.update('entities', attrs, ['eid']), attrs)