Spring数据neo4j休息3.3.0错误保存空间索引

时间:2015-03-26 19:37:49

标签: java rest spatial spring-data-neo4j

我从3.1.1迁移到spring-data-neo4j-rest v3.3.0。在我编译并运行正常之后我发现的是在保存具有空间属性的实体(wkt)时出现错误,该实体应该由LocationIndex索引编制索引。

我得到的错误是:

{
"message": "NODE[30127] has no property with propertyKey=\"wkt\".",
"exception": "NotFoundException",
"fullname": "org.neo4j.graphdb.NotFoundException",
"stacktrace": [
    "org.neo4j.kernel.impl.core.NodeProxy.getProperty(NodeProxy.java:378)",
    "org.neo4j.gis.spatial.WKTGeometryEncoder.decodeGeometry(WKTGeometryEncoder.java:44)",
    "org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.add(LayerNodeIndex.java:126)",
    "org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.add(LayerNodeIndex.java:41)",
    "org.neo4j.server.rest.web.DatabaseActions.addToNodeIndex(DatabaseActions.java:708)",
    "org.neo4j.server.rest.web.RestfulGraphDatabase.addToNodeIndex(RestfulGraphDatabase.java:1058)",
    "java.lang.reflect.Method.invoke(Method.java:606)",
    "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)",
    "java.lang.Thread.run(Thread.java:745)"
],
"cause": {
    "message": "NODE[30127] has no property with propertyKeyId=20.",
    "exception": "PropertyNotFoundException",
    "fullname": "org.neo4j.kernel.api.exceptions.PropertyNotFoundException",
    "stacktrace": [
        "org.neo4j.kernel.api.properties.NoProperty.value(NoProperty.java:93)",
        "org.neo4j.kernel.impl.core.NodeProxy.getProperty(NodeProxy.java:374)",
        "org.neo4j.gis.spatial.WKTGeometryEncoder.decodeGeometry(WKTGeometryEncoder.java:44)",
        "org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.add(LayerNodeIndex.java:126)",
        "org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.add(LayerNodeIndex.java:41)",
        "org.neo4j.server.rest.web.DatabaseActions.addToNodeIndex(DatabaseActions.java:708)",
        "org.neo4j.server.rest.web.RestfulGraphDatabase.addToNodeIndex(RestfulGraphDatabase.java:1058)",
        "java.lang.reflect.Method.invoke(Method.java:606)",
        "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)",
        "java.lang.Thread.run(Thread.java:745)"
    ]
}

}

在调用addToIndex方法之前,对象确实具有该属性,因此我看到了检查属性:

@Override
    public <T extends PropertyContainer> void addToIndex(T entity, RestIndex index, String key, Object value) {
        final RestEntity restEntity = (RestEntity) entity; //at this point "wkt":"POINT(-12.130000 51.120000)"
        String uri = restEntity.getUri();       
        if (value instanceof ValueContext) {
            value = ((ValueContext)value).getCorrectValue();
        }
        final Map<String, Object> data = map("key", key, "value", value, "uri", uri);
        final RequestResult result = getRestRequest().post(indexPath(index, null, null), data);
        if (result.statusOtherThan(Status.CREATED)) throw new RuntimeException(String.format("Error adding element %d %s %s to index %s", restEntity.getId(), key, value, index.getIndexName()));
    }

如果我撤消我的更改并返回到v3.1.1,点击相同的数据库(带有空间2.1.2插件的neo4j 2.1.1),它就像魅力一样。

可能是在调用addToIndex方法之前,属性没有保存到数据库中吗?

0 个答案:

没有答案