# HG changeset patch # User Arthur Lutz <arthur.lutz@logilab.fr> # Date 1466075252 -7200 # Thu Jun 16 13:07:32 2016 +0200 # Node ID 3ddc6796152c48862414ddd84c3fe783a2b0c91b # Parent cab90345e584cbc333c8ee2db82b6cccff006a9e [optimisation] cwuri need to be in RQL, otherwise it *really* slows down the indexing when cw accesses entity.cw_uri. Update using entity.cw_attr_cache should be enough, no need to loop over attributes again diff --git a/entities.py b/entities.py --- a/entities.py +++ b/entities.py @@ -38,22 +38,6 @@ 'eid': entity.eid, 'cwuri': entity.cwuri, } - for rschema in entity.e_schema.indexable_attributes(): - attr = rschema.type - try: - value = entity.cw_attr_cache[attr] - except KeyError: - # Bytes - continue - data[attr] = value - for rschema, tschema in entity.e_schema.attribute_definitions(): - if tschema.type in ('Int', 'Float'): - attr = rschema.type - try: - value = entity.cw_attr_cache[attr] - except KeyError: - continue - data[attr] = value data.update(entity.cw_attr_cache) # TODO take a look at what's in entity.cw_relation_cache return data diff --git a/es.py b/es.py --- a/es.py +++ b/es.py @@ -97,7 +97,7 @@ var = next(varmaker) rql.append('%s %s %s' % (V, attr, var)) selected.append(var) - for attr in ('creation_date', 'modification_date',) + CUSTOM_ATTRIBUTES.get(etype, ()): + for attr in ('creation_date', 'modification_date', 'cwuri') + CUSTOM_ATTRIBUTES.get(etype, ()): var = next(varmaker) rql.append('%s %s %s' % (V, attr, var)) selected.append(var)