Hi neo4j community,
I don't quite understand why my query doesn't return NULL when no records are found. It just returns (no changes, no records) when i search for something that is not there.
CALL db.index.fulltext.queryNodes('test', 'car_type:test1')
YIELD node
with coalesce(collect(node.car_type)) as test, node
CALL apoc.do.when(
size(test) = 0,
'RETURN NULL',
'MATCH (c:Car:Vehicle)-[:RACE]->(:Formula1)
WHERE c.car_type = node.car_type
RETURN DISTINCT c',
{test:test,node:node}) YIELD value
RETURN value
CREATE (c:Car:Vehicle {car_type:'Sedan', car_model:'Toyota', car_description:'Used in last 5 years'})
CREATE (c:Car:Vehicle {car_type:'Sedan', car_model:'Toyota', car_description:'Unused in last 3 months'})
CREATE (c:Car:Vehicle {car_type:'Sedan', car_model:'Honda', car_description:'Used in last 2 years'})
MERGE (c)-[:Drives]->(:Driver)
In this example when I search for car_model: *toy* AND car_description:*use* I want the (1st & 2nd) results returned and its attached nodes and if I search for something that isnt there I want to return NULL.