1

I'm migrating to spring-data-neo4j-rest v3.3.0 from 3.1.1. What I found after everything was compiling and running ok is that I get an error when saving an entity with a spatial property in it (wkt) which is supposed to be indexed by the LocationIndex index.

The error I get is:

{
"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)"
    ]
}

}

The object does have that property in it before calling the addToIndex method and so I saw inspecting the properties:

@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()));
    }

If I undo my changes and go back to v3.1.1, hitting the same database (neo4j 2.1.1 with spatial 2.1.2 plugin), it works like charm.

May it be that the properties are not saved into the database before calling the addToIndex method?

Amin Abu-Taleb
  • 4,423
  • 6
  • 33
  • 50
  • Hi, Have you get any solution for this question? I'm facing one issue related to this. [link](http://stackoverflow.com/q/33830291/4601657?sem=2) please check it and if you have any idea then please suggest me. Thanks !! – niraj darji Nov 21 '15 at 09:39

0 Answers0