0
votes

Iam trying to make a simple ordering using objectify and GAE. Unfortunatly it does't work. here is a simple example

class Book{  
     int publishYear;  
     long price;  
}

According to google, you have to order the field that you made your inequality filtering on it. so i did the following

query.filter("publishYear >=", year)  
query.order("publishYear")

then i want to order with price so i added the line

query.order("price")

but nothing is happening. I tried on different fields, it seems you can make only one order per query. Although this example says something different

http://code.google.com/appengine/docs/java/datastore/queries.html#Restrictions_on_Queries

Anybody has a clue? thanks in advance

1

1 Answers

1
votes

The Objectify documentation says:

To run queries by filtering or sorting against multiple properties (that is, if it can't be satisfied by a zigzag merge on single-property indexes), you must create a multi-value index in your datastore-indexes.xml. There is a great deal written on this subject; we recommend How Entities and Indexes are Stored and Index Building.

Hope it will helps.