我已经包含 Geoespacial 查询来检查 GeoPt 是否在圆内,并且我已经为它创建了一个索引。 当我尝试将其部署到 GAE 时,出现以下错误:
Creating an index failed for entity_type: "MyEntity" ancestor: falseProperty { name: "name"}Property { name: "location" mode: 3}: Permission denied for creating a search index
这是我正在执行的代码
GeoPt center = new GeoPt((float) pLatitude, (float) pLongitude);
double radius = pDistanceKM*1000;
Query.Filter f = new StContainsFilter("location", new Circle(center, radius));
items = ofy().load().type(MyEntity.class).filter(f).filter("name", tmpName).list();
我已经根据 documentation 创建了一个索引:
这是我的索引:
<datastore-index kind="MyEntity" source="manual">
<property name="name" />
<property name="location" mode="geospatial"/>
</datastore-index>
有人知道这个权限是什么吗?
使用 Java 和 Android Studio。
Ps: 当我尝试执行代码时,GAE 中的 Logging 建议我使用与我的索引相同的索引
com.google.api.server.spi.SystemService invokeServiceMethod: exception occurred while calling backend method com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found. The suggested index for this query is:
<datastore-index kind="MyEntity" source="manual">
<property name="name" />
<property name="location" mode="geospatial"/>
</datastore-index>
最佳答案
Datastore 的地理空间搜索是一个 Alpha release目前已达到容量。查看错误,您似乎不属于 Alpha 计划。
敬请期待对所有人开放的测试版!
关于java - 创建搜索索引 GAE 地理空间查询的权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35167767/