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

authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
changeseta9a0b699f3da
branchdefault
phasepublic
hiddenno
parent revision#4cb5b3c2a4b3 [IFullTextIndexSerializable] use fulltext_indexable_attributes attribute to update cw_attr_cache
child revision#7859ebfada15 allow overriding of ES id attribute, #dfaf162a655e allow overriding of ES id attriubte
files modified by this revision
cubicweb_elasticsearch/entities.py
# 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
@@ -116,12 +116,11 @@
1              'cw_etype': entity.cw_etype,
2              'eid': entity.eid,
3              'cwuri': entity.cwuri,
4          }
5          for attr in self.fulltext_indexable_attributes:
6 -            if attr in entity.cw_attr_cache:
7 -                data[attr] = entity.cw_attr_cache[attr]
8 +            data[attr] = getattr(entity, attr)
9          # TODO take a look at what's in entity.cw_relation_cache
10          return data
11 
12 
13  class File(IFullTextIndexSerializable):