1

I get an "Sequence contains no matching element" error when I add a "distance" method to the where clause. After research, everything was saying that I had to install a plugin to add spatial support to Neo4j...however all of these articles and questions were ~5 years old.

Spatial now appears to be baked into the Neo4j server because I'm able to run this in the browser without installing additional plugins.

I have all of my nodes configured with a point property, and the query works fine in the browser.

This is the query that works fine in the browser:

MATCH (m:Person {userId: '7J4OwwnmQ1fMhavSLeLkDkKe9Kl2'})
MATCH (o:Person)
WHERE distance(m.location, o.location) < 1609344
RETURN o

One of the posts I found from 5 years ago mentioned using the "withindistance" function inside of the Start clause. I tried that and got an Index not found error...even though it was (verified through CALL db.indexes)

Leeland Clay
  • 112
  • 1
  • 11
  • Hi, are you trying to do this in `Neo4jClient`? Have you got the code you've tried? – Charlotte Skardon Apr 25 '19 at 06:53
  • Sorry for slow response. Yes, I'm using Neo4jClient. Well...I was. I asked this question on Neo4j's boards as well hoping that someone had seen it. There was a couple of people who told me that the distance function had not been implemented on Neo4jClient yet. Since I need this right now, I switched over to the official driver which supports the distance function beautifully (without additional plugins). – Leeland Clay Apr 30 '19 at 14:38
  • If the official driver supports it, Neo4jClient does as well - you can always just use plain strings in the `where` clause – Charlotte Skardon Apr 30 '19 at 14:41
  • I'll have to come back and try it again at some point. The query I have above is exactly what I put into the .Match, .Where, and .Return methods. Adding the distance method threw an error every time that it was an unexpected character. I originally started with a more complex query and only got the error after adding distance...removing it got rid of the error...and isolating it caused the error again. – Leeland Clay Apr 30 '19 at 14:47
  • Interesting, I'll give it a whirl and see where it goes! – Charlotte Skardon Apr 30 '19 at 14:56

0 Answers0