repair stuff broken by fti handling changes stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 05 Mar 2010 17:24:01 +0100
branchstable
changeset 4816 c02583cb80a9
parent 4815 4ee224c4c41d
child 4818 9f9bfbcdecfd
repair stuff broken by fti handling changes
server/checkintegrity.py
server/sources/pyrorql.py
--- a/server/checkintegrity.py	Fri Mar 05 17:22:41 2010 +0100
+++ b/server/checkintegrity.py	Fri Mar 05 17:24:01 2010 +0100
@@ -68,7 +68,6 @@
     """reindex all entities in the repository"""
     # deactivate modification_date hook since we don't want them
     # to be updated due to the reindexation
-    from cubicweb.server.repository import FTIndexEntityOp
     repo = session.repo
     cursor = session.pool['system']
     if not repo.system_source.indexer.has_fti_table(cursor):
@@ -104,9 +103,11 @@
         pb.update()
     # reindex entities by generating rql queries which set all indexable
     # attribute to their current value
+    source = repo.system_source
     for eschema in etypes:
         for entity in session.execute('Any X WHERE X is %s' % eschema).entities():
-            FTIndexEntityOp(session, entity=entity)
+            source.fti_unindex_entity(session, entity.eid)
+            source.fti_index_entity(session, entity)
         if withpb:
             pb.update()
     # restore Entity.check
--- a/server/sources/pyrorql.py	Fri Mar 05 17:22:41 2010 +0100
+++ b/server/sources/pyrorql.py	Fri Mar 05 17:24:01 2010 +0100
@@ -182,6 +182,7 @@
         self._query_cache.clear()
         repo = self.repo
         session = repo.internal_session()
+        source = repo.system_source
         try:
             for etype, extid in modified:
                 try:
@@ -191,7 +192,7 @@
                         rset = session.eid_rset(eid, etype)
                         entity = rset.get_entity(0, 0)
                         entity.complete(entity.e_schema.indexable_attributes())
-                        repo.index_entity(session, entity)
+                        source.index_entity(session, entity)
                 except:
                     self.exception('while updating %s with external id %s of source %s',
                                    etype, extid, self.uri)