Sorting

Now we are comfortable with querying the data, it is time to put it in some desirable order. That is, sorting the results. How do we do that? Our old friend search.QueryOptions takes a keyword argument called sort_options. We just have to supply that and we are done. Okay, so the question is what this sort_options argument would be?

It's actually an instance of search.SortOptions class which takes a single argument called expressions. What is expressions then? It is just a list of search.SortExpression instances where search.SortExpression constructor takes some keyword arguments which define the sorting behavior.

All this seems bit complicated so let's take another look.

  • Whenever you are going to sort, you are either going to sort on a ...

Get Mastering Google App Engine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.