i have a problem with neo4j. I don't know if problem is my query or something else.
Intro
I have to build an application that store bus/train routes. This is my schema:
Nodes:
- Organizaton: company that have routes/bus etc..
- Route: A bus route like: Paris - Berlin.
- Vehicle(Bus in this case): Fisical bus with a unique license plate.
- Stops: point in a map with latitude and longitude.
Important Relationships:
- NEXT: This is a really important relationship.
NEXT relationships contains those properties:
- startHour
- startMinutes
- endHour
- endMinutes
- dayOfWeek (from 0 to 6 - Sun, Mon etc..)
- vehicleId
Problem
My query is:
MATCH (s1:Stop {id: {departureStopId}}), (s2:Stop {id: {arrivalStopId}})
OPTIONAL MATCH (s1)-[nexts:NEXT*]->(s2)
WHERE ALL(i in nexts WHERE toInt(i.dayOfWeek) = {dayOfWeek} AND toInt(i.startHour) >= {hour})
RETURN nexts
LIMIT 10
For example: I wanna found all nexts relationships where dayOfWeek is Sunday (0) and property startHour > 11
After that I usually parse and validate final object on my nodejs backend.
This works when i was at the start.. with 1k relationships.. Now i have 10k relationships and my query have a TIMEOUT problem or queries are solved in 30s.. too much time... I have no idea how to solve this. I use neo4j with docker and i tried to read settings docs but i have no idea how Java works.
Can you help me guys?
UPDATE
Thank you all guys! For now i solved with "allShortestPaths" but I think i will rename all relationships (like Michael Hunger said).
