# HG changeset patch # User Samuel Trégouët <samuel.tregouet@logilab.fr> # Date 1465922519 -7200 # Tue Jun 14 18:41:59 2016 +0200 # Node ID c169e8fd2ec45498de2644292fd86879da05ed3a # Parent 815e7137f5278a41ccdda0290fc0fc7506fb79ef [es] automatically index `int` and `float` attributes `indexable_attributes` in yams return only String and Bytes diff --git a/entities.py b/entities.py --- a/entities.py +++ b/entities.py @@ -46,6 +46,14 @@ # 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 return data diff --git a/es.py b/es.py --- a/es.py +++ b/es.py @@ -75,6 +75,12 @@ var = next(varmaker) rql.append('%s %s %s' % (V, attr, var)) selected.append((attr, var)) + for rschema, tschema in schema.eschema(etype).attribute_definitions(): + if tschema.type in ('Int', 'Float'): + attr = rschema.type + var = next(varmaker) + rql.append('%s %s %s' % (V, attr, var)) + selected.append((attr, var)) for attr in ('creation_date', 'modification_date'): var = next(varmaker) rql.append('%s %s %s' % (V, attr, var))