I'm trying to get a filtered list from the data store using Objectify, but keep getting an empty list back. I tried adding @index and also creating a datastore-index.xml file, but still get undefined back.
My Listing class:
@Entity
@Index
public class Listing {
@Id private Long id;
@Index private double price;
...
My Api:
@Api(name ="xxxx")
@PersistenceCapable(detachable = "true")
public class ListingServiceAPI {
@ApiMethod(name = "getListings")
public List<Listing> getListings() {
return ofy().load().type(Listing.class).filter("price >", 15).list(); //this fails
//return ofy().load().type(Listing.class).limit(3).list(); //this works
}
}
datastore-indexes.xml:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<datastore-indexes autoGenerate="true">
<datastore-index kind="Listing" ancestor="false">
<property name="price" direction="asc" />
<property name="category" direction="asc" />
</datastore-index>
</datastore-indexes>
Anybody know how to fix this to get the filter query to work?