I have a query with 2 different return nodes. My question is why when I return m2 node, result will change and when remove m2 node from return statement, result will change too. result dcount change by removing or adding m2. my question is why?!!
first query with m2 in return statement:
MATCH (a1:Example)<-[r1:REL_EXAMPLE]-(a2:Example),
(a1)-[:REL_2_EXAMPLE]->(m1:Mexample),
(a2)-[:REL_2_EXAMPLE]->(m2:Mexample)
WHERE a1.key = 123456
AND a2.key <> a1.key
AND (r1.delta < 300 AND r1.delta > 20)
AND ((a1.love <> 0 OR a2.love <> 0) OR (abs(a1.love - a2.love) < 0.1))
WITH a1,a2,m1,m2,r1, CASE
WHEN exists((m1)<-[:REL_2_EXAMPLE]-(a2)) OR exists((m2)<-[:REL_2_EXAMPLE]-(a1)) THEN 0.20
ELSE 1
END AS factor
RETURN count(r1) * factor as dcount,a2.title as anode, a2.key as id, m2.full_name ORDER BY dcount DESC LIMIT 30;
second query without m2:
MATCH (a1:Example)<-[r1:REL_EXAMPLE]-(a2:Example),
(a1)-[:REL_2_EXAMPLE]->(m1:Mexample),
(a2)-[:REL_2_EXAMPLE]->(m2:Mexample)
WHERE a1.key = 123456
AND a2.key <> a1.key
AND (r1.delta < 300 AND r1.delta > 20)
AND ((a1.love <> 0 OR a2.love <> 0) OR (abs(a1.love - a2.love) < 0.1))
WITH a1,a2,m1,m2,r1, CASE
WHEN exists((m1)<-[:REL_2_EXAMPLE]-(a2)) OR exists((m2)<-[:REL_2_EXAMPLE]-(a1)) THEN 0.20
ELSE 1
END AS factor
RETURN count(r1) * factor as dcount,a2.title as anode, a2.key as id ORDER BY dcount DESC LIMIT 30;