equal
deleted
inserted
replaced
1259 FTIndexEntityOp.get_instance(cnx).add_data(entity.eid) |
1259 FTIndexEntityOp.get_instance(cnx).add_data(entity.eid) |
1260 |
1260 |
1261 def fti_unindex_entities(self, cnx, entities): |
1261 def fti_unindex_entities(self, cnx, entities): |
1262 """remove text content for entities from the full text index |
1262 """remove text content for entities from the full text index |
1263 """ |
1263 """ |
|
1264 if not cnx.repo.system_source.do_fti: |
|
1265 return |
1264 cursor = cnx.cnxset.cu |
1266 cursor = cnx.cnxset.cu |
1265 cursor_unindex_object = self.dbhelper.cursor_unindex_object |
1267 cursor_unindex_object = self.dbhelper.cursor_unindex_object |
1266 try: |
1268 try: |
1267 for entity in entities: |
1269 for entity in entities: |
1268 cursor_unindex_object(entity.eid, cursor) |
1270 cursor_unindex_object(entity.eid, cursor) |
1270 self.exception('error while unindexing %s', entity) |
1272 self.exception('error while unindexing %s', entity) |
1271 |
1273 |
1272 def fti_index_entities(self, cnx, entities): |
1274 def fti_index_entities(self, cnx, entities): |
1273 """add text content of created/modified entities to the full text index |
1275 """add text content of created/modified entities to the full text index |
1274 """ |
1276 """ |
|
1277 if not cnx.repo.system_source.do_fti: |
|
1278 return |
1275 cursor_index_object = self.dbhelper.cursor_index_object |
1279 cursor_index_object = self.dbhelper.cursor_index_object |
1276 cursor = cnx.cnxset.cu |
1280 cursor = cnx.cnxset.cu |
1277 try: |
1281 try: |
1278 # use cursor_index_object, not cursor_reindex_object since |
1282 # use cursor_index_object, not cursor_reindex_object since |
1279 # unindexing done in the FTIndexEntityOp |
1283 # unindexing done in the FTIndexEntityOp |
1294 """ |
1298 """ |
1295 |
1299 |
1296 def precommit_event(self): |
1300 def precommit_event(self): |
1297 cnx = self.cnx |
1301 cnx = self.cnx |
1298 source = cnx.repo.system_source |
1302 source = cnx.repo.system_source |
|
1303 if not source.do_fti: |
|
1304 return |
1299 pendingeids = cnx.transaction_data.get('pendingeids', ()) |
1305 pendingeids = cnx.transaction_data.get('pendingeids', ()) |
1300 done = cnx.transaction_data.setdefault('indexedeids', set()) |
1306 done = cnx.transaction_data.setdefault('indexedeids', set()) |
1301 to_reindex = set() |
1307 to_reindex = set() |
1302 for eid in self.get_data(): |
1308 for eid in self.get_data(): |
1303 if eid in pendingeids or eid in done: |
1309 if eid in pendingeids or eid in done: |