spatial
spatial copied to clipboard
Cypher query to return nodes using spatial instead deleting nodes
Created a spatial index: "cities" Add a node with the proper fields needed to the index. Use the REST API to verify it comes back and spatial is working, this works. Run a Cypher query to get the results:
start r = node:cities("withinDistance:[35.0,-97.0,10000.0]") return r
This returns 0 rows, if I then check to see if that node still exists, it doesn't, it's been removed.
Running neo4j 2.0.1 and spatial 2.0.1
Anyone else seeing this?
I'm not seeing the behavior that removes the nodes, but I do agree that the cypher query does not work properly if you use the addNodesToLayer method of the plugin. In fact you can see here that it doesn't even work in the unit tests:
"//in this version not supported future feature"
I'm going to try to open up an issue to get some guidance on how to fix this and submit a pull request.
Good catch.
I'm going to try by adding the node to the index in the more conventional way.
— Sent from Mailbox
On Sat, May 24, 2014 at 11:37 AM, P. Daniel Tyreus [email protected] wrote:
I'm not seeing the behavior that removes the nodes, but I do agree that the cypher query does not work properly if you use the addNodesToLayer method of the plugin. In fact you can see here that it doesn't even work in the unit tests: "//in this version not supported future feature"
I'm going to try to open up an issue to get some guidance on how to fix this and submit a pull request.
Reply to this email directly or view it on GitHub: https://github.com/neo4j/spatial/issues/137#issuecomment-44092570
Sorry, yes currently only nodes that are added via the index are returned via cypher. I had a work in progress somehwere that allowed to have different index configs to also allow to return the actual geometry-nodes instead (i.e. when you don't create additional nodes in the geo-index for your domain nodes).
But currently too many other things on my plate to look into that.
@jexp thanks for the confirmation, any thoughts on the deletion of the nodes when doing it how I described above?
Hey guys. We've too have encountered this exact issue while trying to index nodes using the addNodeToLayer (and addNodesToLayer) method. Curiously, using neo's legacy indexing endpoint completely circumvents this issue, and works perfectly.
Did you experience the deleting of the nodes issue as well?
— Sent from Mailbox
On Wed, May 28, 2014 at 6:40 PM, Michael Schonfeld [email protected] wrote:
Hey guys. We've too have encountered this exact issue while trying to index nodes using the addNodeToLayer (and addNodesToLayer) method. Curiously, using neo's legacy indexing endpoint completely circumvents this issue, and works perfectly.
Reply to this email directly or view it on GitHub: https://github.com/neo4j/spatial/issues/137#issuecomment-44478515
@jturmel I did! Every time I cypher using spatial queried (START locations = node:locations('withinDistance:[...]') return locations), it would return 0 results, and proceed to delete any associated nodes.
I think the problem stems from confusion about using the 'id' property and connecting your 'real' node that you want to the rtree instead of using an intermediary node that is going to point to the node you want.
When using the /db/data/index endpoint provided by legacy indexing from neo4j you get that 'for free' while using the /addNodeToLayer does not. The reason nodes start getting deleted is because the end user, innocently, used an "id" property for their own purposes and then connect that node to the tree. Then GeoPipeFlowHits tries to fetch the first record and inside underlyingObjectToObject doesn't find it by the so called "id" given since it takes that string and then searches the neo4j db for that literal id. Since it doesn't find it, an exception is generated which subsequently ends up making a call to itemDodged removing that node.
Ofcourse reading the top comment in GeoPipeFlowHits tells you why that was done that way, but here we have a situation where we end up inside itemDodged without really having a node that was removed from the index but not removed from the database.
@jturmel what do you think is the best way to go about this misunderstanding? I can help with pull requests as long as you tell me where you want to take it
Okay, I see what you're saying.
Would just some better documentation suffice then? Not sure, I don't feel I know enough about the internals of spatial to give a highly valuable opinion. :)
Oh sorry I meant to cc @jexp - my apologies @jturmel