[fti] make db-rebuild-fti accept etypes on command line (closes #2410508)
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Fri, 06 Jul 2012 09:00:32 +0200
changeset 8449 cc83a3f16c0f
parent 8448 c5fff93d3a1c
child 8450 11063635c4e4
[fti] make db-rebuild-fti accept etypes on command line (closes #2410508)
server/serverctl.py
--- a/server/serverctl.py	Fri Jul 06 09:00:30 2012 +0200
+++ b/server/serverctl.py	Fri Jul 06 09:00:32 2012 +0200
@@ -993,20 +993,24 @@
 class RebuildFTICommand(Command):
     """Rebuild the full-text index of the system database of an instance.
 
-    <instance>
+    <instance> [etype(s)]
       the identifier of the instance to rebuild
+
+    If no etype is specified, cubicweb will reindex everything, otherwise
+    only specified etypes will be considered.
     """
     name = 'db-rebuild-fti'
     arguments = '<instance>'
-    min_args = max_args = 1
+    min_args = 1
 
     def run(self, args):
         from cubicweb.server.checkintegrity import reindex_entities
-        appid = args[0]
+        appid = args.pop(0)
+        etypes = args or None
         config = ServerConfiguration.config_for(appid)
         repo, cnx = repo_cnx(config)
         session = repo._get_session(cnx.sessionid, setcnxset=True)
-        reindex_entities(repo.schema, session)
+        reindex_entities(repo.schema, session, etypes=etypes)
         cnx.commit()