对象化投影查询返回 null

Objectify projection queries returning null

我似乎无法将我的投影查询查询到 return 除了 null,我不确定我做错了什么。 这是我设置和调用查询的代码:

    Query query1 = OfyService.ofy().load().type(CargoEntity.class).
       project("imageUrl", "latitude", "longitude").distinct(false); //filter("group", group);

    // Execute the query:
    List<Entity> results = query1.list();

    logger.warning("(Query from datastore results.isEmpty()) : " + (results.isEmpty()));
    logger.warning("(Group = ) : " + group);

    if (!results.isEmpty()) {
        logger.warning("(Query from datastore results.size()) : " + (results.size()));
        //Create STRTree-Index.
        STRtree strTree = new STRtree();
        GeometryFactory gf = new GeometryFactory();

        //Loop through the  result list from DataStore.
        for (Entity result : results) {

            STRLeaf leaf = new STRLeaf((float)result.getProperty("latitude"), (float)result.getProperty("longitude"), (String)result.getProperty("imageUrl"));

            Coordinate coord = new Coordinate(leaf.getLongitude(), leaf.getLatitude());

            Point point = gf.createPoint(coord);

            //Add result to index.
            strTree.insert(point.getEnvelopeInternal(), leaf);
        }

我对此很陌生,所以很明显我遗漏了一些东西。不过,我确实在开发人员控制台中看到了索引。这是我的实体中的属性:

@Entity
@Index
@Cache
public class CargoEntity {

//datastore key
@Id
private String imageUrl;
private float latitude;
private float longitude;
private String group;
@Unindex
private int rating;
@Unindex
private Blob image;
@Unindex
private String email;
@Unindex
private String userName;
@Unindex
private String description;
@Unindex
private Date date;
@Unindex
private String blobKey;
@Unindex
private String type;
@Unindex
private boolean flag;
@Unindex
private int photoOrientation;

public CargoEntity() {
}
//getters and setters below

所以显然我将实体 ID 添加到投影查询中,这是不允许的(或者它是允许的,但 returns 为空)。这 post 解决了问题。

Google App Engine projection query returns 0 results