[source/native] do NOT do anything with fti if do_fti is False 3.26
authorDavid Douard <david.douard@logilab.fr>
Wed, 13 Dec 2017 01:23:39 +0100
branch3.26
changeset 12290 2b049c9fcec5
parent 12289 b86214011758
child 12291 b640ef6ad633
[source/native] do NOT do anything with fti if do_fti is False ensure no fti related process is done when fti is disabled on a db source.
cubicweb/server/sources/native.py
--- a/cubicweb/server/sources/native.py	Thu Apr 19 15:55:33 2018 +0200
+++ b/cubicweb/server/sources/native.py	Wed Dec 13 01:23:39 2017 +0100
@@ -1261,6 +1261,8 @@
     def fti_unindex_entities(self, cnx, entities):
         """remove text content for entities from the full text index
         """
+        if not cnx.repo.system_source.do_fti:
+            return
         cursor = cnx.cnxset.cu
         cursor_unindex_object = self.dbhelper.cursor_unindex_object
         try:
@@ -1272,6 +1274,8 @@
     def fti_index_entities(self, cnx, entities):
         """add text content of created/modified entities to the full text index
         """
+        if not cnx.repo.system_source.do_fti:
+            return
         cursor_index_object = self.dbhelper.cursor_index_object
         cursor = cnx.cnxset.cu
         try:
@@ -1296,6 +1300,8 @@
     def precommit_event(self):
         cnx = self.cnx
         source = cnx.repo.system_source
+        if not source.do_fti:
+            return
         pendingeids = cnx.transaction_data.get('pendingeids', ())
         done = cnx.transaction_data.setdefault('indexedeids', set())
         to_reindex = set()