new delay-full-text-indexation configuration option
authorsylvain.thenault@logilab.fr
Thu, 26 Mar 2009 09:08:05 +0100
changeset 1160 77bf88f01fcc
parent 1159 16a426d214ae
child 1161 936c311010fc
new delay-full-text-indexation configuration option
server/repository.py
server/serverconfig.py
--- a/server/repository.py	Wed Mar 25 16:13:23 2009 +0100
+++ b/server/repository.py	Thu Mar 26 09:08:05 2009 +0100
@@ -211,7 +211,8 @@
         self._get_pool().close(True) 
         for i in xrange(config['connections-pool-size']):
             self._available_pools.put_nowait(ConnectionsPool(self.sources))
-     
+        self.do_fti = config['delay-full-text-indexation']
+        
     # internals ###############################################################
 
     def get_source(self, uri, source_config):
@@ -829,7 +830,8 @@
             entity.complete(entity.e_schema.indexable_attributes())
         session.add_query_data('neweids', entity.eid)
         # now we can update the full text index
-        FTIndexEntityOp(session, entity=entity)
+        if self.do_fti:
+            FTIndexEntityOp(session, entity=entity)
         CleanupEidTypeCacheOp(session)
         
     def delete_info(self, session, eid):
@@ -995,7 +997,7 @@
                                     entity)
         source.update_entity(session, entity)
         if not only_inline_rels:
-            if need_fti_update:
+            if need_fti_update and self.do_fti:
                 # reindex the entity only if this query is updating at least
                 # one indexable attribute
                 FTIndexEntityOp(session, entity=entity)
--- a/server/serverconfig.py	Wed Mar 25 16:13:23 2009 +0100
+++ b/server/serverconfig.py	Thu Mar 26 09:08:05 2009 +0100
@@ -73,6 +73,15 @@
           'help': 'size of the parsed rql cache size.',
           'group': 'main', 'inputlevel': 1,
           }),
+        ('delay-full-text-indexation',
+         {'type' : 'yn', 'default': False,
+          'help': 'When full text indexation of entity has a too important cost'
+          ' to be done when entity are added/modified by users, activate this '
+          'option and setup a job using cubicweb-ctl db-rebuild-fti on your '
+          'system (using cron for instance).',
+          'group': 'main', 'inputlevel': 1,
+          }),
+        
         # email configuration
         ('default-recipients-mode',
          {'type' : 'choice',