While using neo4j, I encountered a problem in an use case where i need to fetch data using cypher order by number of relation from input set of nodes.
I am very new to neo4j and regrets if the problem is too naive.
Demo graph:
What i am trying to do is, for an input string say "java developer engineer" return all nodes, connected to node java, developer and engineer but give highest priority to node connected to all three of them then low priority to nodes connected to 2 and lowest to nodes connected with only 1 of them.
I have written a basic query:
match(n:Token{name:"java"})-[res]->(y)
match(n1:Token{name:"developer"})-[res1]->(y1)
match(x:Token{name:"engineer"})-[res2]->(y2)
return n,n1,x,res,res1,res2,y,y1,y2
Issues i am facing is with prioritizing nodes connected with all 3 input nodes, handling case if any incorrect input token present (say java, developer, engineer and tesla, where tesla is not a token).
Thanks