title: Neo4j-Multiple match statement in cypher query with if else conditon
body: <p>I have to search certain nodes like eq.page whether or not they have relation or not with some other node..like tags.</p>
  
  <blockquote>
  <pre><code> If they are connected to tag nodes then search for the search string in page name and the tag names 
  
  Else search for the search string in page name only
  </code></pre>
  </blockquote>
  
  <pre><code>MATCH ...//nodes of certain type    
  WHERE    
      if r is null'
        ...//Match query without relation for searching
      else 
        ...//Match query without relation for searching
  
  Return ...
  
  MATCH (n:page)&lt;-[r:pagetag]-(tag)
  if  r is null 
  then n.title CONTAINS 'java'or tag.name IN ["java"] 
  return distinct n.name
  else  n.title CONTAINS 'java'return distinct n.name
    END
  </code></pre>
  
  <p>This query is giving error. May be syntax problem. But I want to search for  like this only for the pages.</p>