Query query1 = OfyService.ofy().load().type(CargoEntity.class).
project("imageUrl", "latitude", "longitude").distinct(false);
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()));
STRtree strTree = new STRtree();
GeometryFactory gf = new GeometryFactory();
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);
strTree.insert(point.getEnvelopeInternal(), leaf);
我真的是个新手,所以可能是我漏掉了什么明显的东西。 不过我确实在开发者控制台中看到了索引。 这是我的实体中的属性看起来像什么。
@Entity
@Index
@Cache
public class CargoEntity {
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() {