Yes, that part is fine. The problem is in the building of the
Expression object.

In gql.py:Expression:__or__():

was:
        return Expression(self.name if self.type!='id' else '__key__'
+ '|' + other.name if other.type!='id' else '__key__', None, None)

should be:
        return Expression((self.name if self.type!='id' else
'__key__') + '|' + (other.name if other.type!='id' else '__key__'),
None, None)


On Nov 2, 1:55 am, mdipierro <[email protected]> wrote:
> This is the code in web2py/gluon/contrib/gql.py
>
> if orderby:
>                 if isinstance(orderby, (list, tuple)):
>                     orderby = gluon.sql.xorify(orderby)
>                 assert_filter_fields(orderby)
>                 if orderby.type == 'id':
>                     orders = ['__key__']
>                 else:
>                     orders = orderby.name.split('|')
>                 for order in orders:
>                     items = items.order(order)
>
> I think web2py handles it correctly. Either there is a problem on the
> gae side or the indices have not been created.
>
> On Nov 1, 7:04 am, MicLee <[email protected]> wrote:
>
> > Is it possible to order by multiple fields on GAE?
>
> > I tried this (both title and subtitle are strings):
> > pages = db().select(db.page.ALL,orderby=db.page.title|
> > db.page.subtitle)
>
> > But apparently the results are ordered by the title field only.
>
> > Looking into the index.yaml, there is NO composite index for those 2
> > fields generated.
>
> > Thank you.
>
>

Reply via email to