[fti] simplify UpdateFTIHook code stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 11 May 2010 16:58:35 +0200
branchstable
changeset 5514 3679015c0a50
parent 5513 07b32d9d8804
child 5515 513af9be9e37
[fti] simplify UpdateFTIHook code
hooks/metadata.py
--- a/hooks/metadata.py	Tue May 11 16:48:26 2010 +0200
+++ b/hooks/metadata.py	Tue May 11 16:58:35 2010 +0200
@@ -160,18 +160,10 @@
         rtype = self.rtype
         session = self._cw
         ftcontainer = session.vreg.schema.rschema(rtype).fulltext_container
-        if self.event == 'after_add_relation':
-            if ftcontainer == 'subject':
-                session.repo.system_source.index_entity(
-                    session, session.entity_from_eid(self.eidfrom))
-            elif ftcontainer == 'object':
-                session.repo.system_source.index_entity(
-                    session, session.entity_from_eid(self.eidto))
-        # after delete relation
-        elif ftcontainer == 'subject':
+        if ftcontainer == 'subject':
             session.repo.system_source.index_entity(
-                session, entity=session.entity_from_eid(self.eidfrom))
+                session, session.entity_from_eid(self.eidfrom))
         elif ftcontainer == 'object':
             session.repo.system_source.index_entity(
-                session, entity=session.entity_from_eid(self.eidto))
+                session, session.entity_from_eid(self.eidto))