# HG changeset patch
# User Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
# Date 1495475637 -7200
#      Mon May 22 19:53:57 2017 +0200
# Node ID a9a0b699f3da42a7b5686a24232d63caded8b3dd
# Parent  4cb5b3c2a4b362f54ad2364a644d7ea1e4e92946
attr indexation should not depend on its presence in cw_attr_cache

For optimization sake, just make sure the original rset
fetches everyting or use complete=True but relying on
cw_attr_cache will cause very obscure bugs

closes #17079907

diff --git a/cubicweb_elasticsearch/entities.py b/cubicweb_elasticsearch/entities.py
--- a/cubicweb_elasticsearch/entities.py
+++ b/cubicweb_elasticsearch/entities.py
@@ -118,8 +118,7 @@
             'cwuri': entity.cwuri,
         }
         for attr in self.fulltext_indexable_attributes:
-            if attr in entity.cw_attr_cache:
-                data[attr] = entity.cw_attr_cache[attr]
+            data[attr] = getattr(entity, attr)
         # TODO take a look at what's in entity.cw_relation_cache
         return data