I tried below with full text index as below
CALL db.index.fulltext.queryNodes("index1", "x") YIELD node as node1, score as score1
With collect({id: node1.id, score: score1}) as rows1
CALL db.index.fulltext.queryNodes("index2", "name:Y") YIELD node as node2, score as score2
With collect({id: node2.id, score: score2}) as rows2, rows1
return rows1 + rows2 as final
The above returns result if both has some records, if the node2 doesn't have any matching results then the final result is empty even though node1 have few results.
My requirement is to combine or union both which matches any of the condition. Could you please help me to achieve that.
Thanks in advance.
If the index lookup fails, then you won't get any rows back (and previous data for that row is wiped out), and that may shortcircuit your query. You might want to try a UNION of the two results instead:
CALL db.index.fulltext.queryNodes("index1", "x") YIELD node, score
RETURN node, score
UNION
CALL db.index.fulltext.queryNodes("index2", "name:Y") YIELD node, score
RETURN node, score