Hi! I am trying to eliminate a performance bottleneck on one of my legacy systems, pretty sure that graph database is a good fit due to heavy use of graph-like queries, but I need an advice.
For context:
I have a system that deals with users who want to exchange something (let's say apartments) and uses document-oriented database. This system reads the preferences of a user (min/max area, room count, price etc.) and suggests apartments by filtering all available apartments based on these preferences. Note that we also check against the filtering rules of the user of our interest: his preferences should also be satisfied, giving us a "mutual" match.
The query is trivial and everything is good so far. But then comes the second business requirement that caused us a lot of trouble: try suggesting exchange chains of arbitrary length (currently we are limited to the 3) if the second user's preferences are not satisfied and user is (most likely) not interested in our apartment.
When explained on a chain of length 3 as an example, "Suggesting a chain" basically means taking our apartment (A), taking apartment we might have interest in (B) and finding such a C, so that we can extract a chain like [A]-[:SATISFIED_WITH]-[B]-[:SATISFIED_WITH]-[C]-[:SATISFIED_WITH]->[A]. This allows us to exchange with apartment B even if it doesn't want specifically "ours" apartment.
So the problem I see in neo4j right now is: while I might be able to hardcode queries for chains of length 3, chains of length 4, 5, 6 etc., it sounds like something that can be queried in a more elegant way. I have no idea how though, spent numerous hours trying to figure that out. I learned that APOC can do something like that, but only using relationships (previously I was querying based on object parameters comparison and not on relationships) and that means that I need to connect each apartment in my system (there are ten thousands of them) with relationships and update these relationships (possibly 1-5k for each apartment) on each apartment update/insert/delete.
So what do you think about it? I was also thinking about Apache TinkerPop if it would naturally be more suitable for me, but it would be nice to stay on neo4j.