Hi all,
With these schema:
I need to fuse these 2 queries, because in the first approach there is no direct edges, and at the end I have to insert the red edges.
The first cypher, count the nodes between Jobs and Candidates and return a list order by cnt desc
match (a:Job)-[]->(req)
with a.jobId as jobID, collect(ID(req)) as rq1
match (c:Candidate)-[]->(req2)
with jobID, rq1, c.candidateId as cndID, collect(ID(req2)) as crq1
with jobID, cndID, apoc.coll.intersection(rq1, crq1) as cmn
with jobID, cndID, cmn, size(cmn) as cnt
return jobID, cndID, cmn, cnt order by cnt desc
The second query get the pair job-candidate with the best number of edges
MATCH (a:Candidate)-[r]-(b:Job)
WITH a, b, COUNT(r) as relCount
ORDER BY relCount DESC
RETURN a.name, b.jobId, relCount order by relCount desc
Now I want to get a query that fuse the two things.
Thank you