marhg
marhg

Reputation: 687

cypher retrieve nodes within a specific range time

I would like to query something like this:

MATCH (u:User)-[r:PICK_UP]->(g:Grid)
WHERE r.time:[16:00 TO 20:00]
RETURN u.name

I read about Lucene’s numeric range query, but i don't know what is the correct syntax for my query

Any suggestions? Thank you!

Upvotes: 0

Views: 99

Answers (1)

William Lyon
William Lyon

Reputation: 8546

Neo4j does not really support indexes on relationship properties. For this reason you should consider storing the time as a property on a node. You can then use an index supported range query:

MATCH (u:User)-[:INITIATED]->(e:Event)-[:PICK_UP]->(g:Grid)
WHERE e.time > 1600 AND e.time < 2000
RETURN u.name;

These type of numeric range queries are supported by an index beginning in Neo4j version 2.3. Be sure to create an index on the time property: CREATE INDEX ON :Event(time)

Upvotes: 1

Related Questions