I have a GAE Entity called MyFile
public class MyFile {
static enum LocationEnum {Folders, Hidden};
static enum FileType {File, Folder);
@Id private Long id;
private Key<MyFile> parent;
private String name;
private LocationEnum location;
private FileType fType;
// getters and setters
}
And a function in a separate DAO class to query for files based on their parent, returning the results ordered by name.
public List<MyFile> getFiles(Key<MyFile> parent) {
Query<MyFile> q1 = ofy().query(MyFile.class).filter("parent", parent).filter("location", LocationEnum.Folders).order("name");
return q1.list();
}
It seems my order is ignored as the results are returned ordered by id. It did occur to me that I was missing something to do with indexing, but I noticed GAE blessed me an auto generated index based on location, parent, name. So I thought it would just work.
How do I order by name?
I’ve found the problem. It is not possible to do a case insensitive search on App Engine. GAE will order by upper case first A-Z followed by a-z.