I'm trying to get a "Friend Recommendation" query. The nodes have the next sequence
(Node) - [FRIEND] - (Node) - [INFO] - (P_info)
where every node have a INFO
relation with a P_info
node asociated. I can get a list of recommended friends of a Node but i need to include the P_info
keys into recommended friends keys to return all together.
This is my query at the moment:
match (person:Account{_id:"185860469"})
match (person)-[:FRIEND]-()-[:FRIEND]-(potentialFriend)
where not (person)-[:FRIEND]-(potentialFriend)
match (potentialFriend)-[:INFO]-(information:P_info)
with person,potentialFriend, COUNT(*) AS friendsInCommon,information
where friendsInCommon > 5
return {user:person,recommend:collect(potentialFriend)},{info:information}
but the information of "info" is not asociated with "potentialFriend" at the response.
I want to do something like this:
return {user:person,collect(potentialFriend,information)}
but i don't know if it's possible, cypher says:
Too many parameters for function 'collect'
thanks in advance.
I did it, just adding an additional WITH
.I leave the answer in case someone helps
WITH person,{friend_id:potentialFriend._id,friend_name:information.name} AS Recommended_friend
RETURN person._id,collect(Recommended_friend)
this will return an unique response with person id and an array with all the recommended friends for him.