0
votes

I am using Neo4j 1.8.2 with spatial 0.9.

I get the following exception when I try to get a handle to the spatial index on an existing graph that contains the index already:

Exception in thread "main" java.lang.IllegalArgumentException: Supplied index configuration: {geometry_type=point, lon=lon, provider=spatial, lat=lat} doesn't match stored config in a valid way: {geometry_type=point, lon=lon, provider=spatial, lat=lat} for 'testspatial' at org.neo4j.kernel.IndexManagerImpl.assertConfigMatches(IndexManagerImpl.java:156) at org.neo4j.kernel.IndexManagerImpl.findIndexConfig(IndexManagerImpl.java:137) at org.neo4j.kernel.IndexManagerImpl.getOrCreateIndexConfig(IndexManagerImpl.java:198) at org.neo4j.kernel.IndexManagerImpl.getOrCreateNodeIndex(IndexManagerImpl.java:301) at org.neo4j.kernel.IndexManagerImpl.forNodes(IndexManagerImpl.java:289) at TestSpatialIndexFetch.createSpatialIndex(TestSpatialIndexFetch.java:22) at TestSpatialIndexFetch.main(TestSpatialIndexFetch.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

If I delete the database, the index is created successfully. If I use this database now to get the index back, it fails.

Any ideas?

Sample test code:

public class TestSpatialIndexFetch {

    public static void main(String[] args) {
        EmbeddedGraphDatabase db = new EmbeddedGraphDatabase("c://neo4jdbs//testindex");
        registerShutdownHook(db);
        Index<Node> index = createSpatialIndex(db, "testspatial");
    }

    private static Index<Node> createSpatialIndex(EmbeddedGraphDatabase db, String indexName) {
        return db.index().forNodes(indexName, SpatialIndexProvider.SIMPLE_POINT_CONFIG);
    }

    private static void registerShutdownHook( final GraphDatabaseService graphDb )
    {
        Runtime.getRuntime().addShutdownHook( new Thread()
        {
            @Override
            public void run()
            {
                graphDb.shutdown();
            }
        } );
    }
}
1

1 Answers