neo4j - increase weight between relationship on finding match - cypher -


i have query in cypher , create relationship between :

match match (u:user {id : "10662"})-[r:has_profile]->(p:profile)    , (u2:user)-[r2:has_profile]->(p2:profile)     p.user_id <> p2.user_id   ,  abs(u2.date_birth - u.date_birth) >= 94608000000  merge u-[r:matches_with { weight: rand() }]->u2  return collect(u2.id) id;

in particular situation, trying create relationship between u , u2 on match, when previous relationship between u , u2 found. increment weight in relationship. , trying return matches based on weight.

can please suggest approach incrementing weight on finding match, query. thank you.

here query looks matches_with relationships starting specific user, increments weight of relationship, , returns results sorted weight.

match (u:user { id : "10662" })-[r:matches_with]->(u2) set r.weight = r.weight + 1 return u, r, u2 order r.weight; 

Comments