Description
As per my post on the google group -> https://groups.google.com/forum/?fromgroups=#!topic/neo4j/mLMhO5C3LL4
I've been playing around with the neo4j spatial stuff (0.11-SNAPSHOT) against the 1.9.M05 release but it seems to have got broken based on commit 84cd357a6024e7d46712f178648b85689954c9f4 from what I can tell.
When I try to run testWithinDistanceIndexViaCypher I get the following exception (I've changed the way it throws the exception in the code to make it easier to see what went wrong):
java.lang.UnsupportedOperationException: only within, WITHINDISTANCE and bbox are implemented. You tried to query [layer3]
at org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.query(LayerNodeIndex.java:283)
at org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext$$anon$1.indexQuery(GDSBackedQueryContext.scala:83)
at org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$$anonfun$getNodeGetter$2.apply(IndexQueryBuilder.scala:83)
at org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$$anonfun$getNodeGetter$2.apply(IndexQueryBuilder.scala:81)
at org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:36)
at org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:35)
....
at org.neo4j.cypher.PipeExecutionResult.next(PipeExecutionResult.scala:144)
at org.neo4j.cypher.PipeExecutionResult.next(PipeExecutionResult.scala:32)
at scala.collection.Iterator$$anon$11.next(Iterator.scala:328)
at scala.collection.convert.Wrappers$IteratorWrapper.next(Wrappers.scala:30)
at org.neo4j.gis.spatial.IndexProviderTest.testWithinDistanceIndexViaCypher(IndexProviderTest.java:263)
....
From what I can tell this is the bit of code which has caused the behaviour to change:
- m => {
- val queryText = query(m)
- val indexHits: JIterable[Relationship] = graph.index.forRelationships(idxName).query(queryText)
- indexHits.asScala
+ (m, state) => {
+ val queryText = query(m)(state)
+ // TODO memory waste
+ state.query.relationshipOps.indexQuery(idxName, queryText).toList
The whole index query used to be passed into the 'public IndexHits query( Object queryOrQueryObject )' method which then split up the query and called the 'public IndexHits query( String key, Object params )' method but now we're calling that second method directly without any of the transformation of the query.
I'm assuming that approach is working for other index providers or it wouldn't have been changed so in that case does it make sense to change the code in LayerNodeIndex to handle this new way of passing on the index query?