1289 """create an operation to [re]index textual content of the given entity |
1289 """create an operation to [re]index textual content of the given entity |
1290 on commit |
1290 on commit |
1291 """ |
1291 """ |
1292 FTIndexEntityOp.get_instance(session).add_data(entity.eid) |
1292 FTIndexEntityOp.get_instance(session).add_data(entity.eid) |
1293 |
1293 |
1294 def fti_unindex_entities(self, session, entities): |
1294 def fti_unindex_entities(self, cnx, entities): |
1295 """remove text content for entities from the full text index |
1295 """remove text content for entities from the full text index |
1296 """ |
1296 """ |
1297 cursor = session.cnxset.cu |
1297 cursor = cnx.cnxset.cu |
1298 cursor_unindex_object = self.dbhelper.cursor_unindex_object |
1298 cursor_unindex_object = self.dbhelper.cursor_unindex_object |
1299 try: |
1299 try: |
1300 for entity in entities: |
1300 for entity in entities: |
1301 cursor_unindex_object(entity.eid, cursor) |
1301 cursor_unindex_object(entity.eid, cursor) |
1302 except Exception: # let KeyboardInterrupt / SystemExit propagate |
1302 except Exception: # let KeyboardInterrupt / SystemExit propagate |
1303 self.exception('error while unindexing %s', entity) |
1303 self.exception('error while unindexing %s', entity) |
1304 |
1304 |
1305 |
1305 |
1306 def fti_index_entities(self, session, entities): |
1306 def fti_index_entities(self, cnx, entities): |
1307 """add text content of created/modified entities to the full text index |
1307 """add text content of created/modified entities to the full text index |
1308 """ |
1308 """ |
1309 cursor_index_object = self.dbhelper.cursor_index_object |
1309 cursor_index_object = self.dbhelper.cursor_index_object |
1310 cursor = session.cnxset.cu |
1310 cursor = cnx.cnxset.cu |
1311 try: |
1311 try: |
1312 # use cursor_index_object, not cursor_reindex_object since |
1312 # use cursor_index_object, not cursor_reindex_object since |
1313 # unindexing done in the FTIndexEntityOp |
1313 # unindexing done in the FTIndexEntityOp |
1314 for entity in entities: |
1314 for entity in entities: |
1315 cursor_index_object(entity.eid, |
1315 cursor_index_object(entity.eid, |