The problem here is that you're using a WITH clause to connect different sub queries. Only variables that are explicitly stated in the WITH clause are carried forward to the next clause.
MATCH (marketplace:`Marketplace`) ...
WITH product, count(productFeed) AS productFeed_count
WHERE id(marketplace) = 123481 and productFeed_count >= 1
RETURN product
You're not carrying marketplace into the WITH clause. So the correct way would be to either add the WHERE condition to the initial MATCH or carry marketplace into the WITHclause:
MATCH (marketplace:`Marketplace`),
(marketplace)-[rel_has_product_products:HAS_PRODUCT]->(products:`Product`),
(product:`Product`),
(product)-[rel_has_product_feed_productFeed:HAS_PRODUCT_FEED]->(productFeed:`ProductFeed`)
WHERE id(marketplace) = 123481
WITH product, count(productFeed) AS productFeed_count
WHERE productFeed_count >= 1
RETURN product
or
MATCH (marketplace:`Marketplace`),
(marketplace)-[rel_has_product_products:HAS_PRODUCT]->(products:`Product`),
(product:`Product`),
(product)-[rel_has_product_feed_productFeed:HAS_PRODUCT_FEED]->(productFeed:`ProductFeed`)
WITH marketplace, product, count(productFeed) AS productFeed_count
WHERE id(marketplace) = 123481 AND productFeed_count >= 1
RETURN product
It seems as if option (1) would be the better way from a performance perspective as it eliminates unneeded paths (those not starting a marketplace 123481) very early in the process.
productsin that marketplace. Instead, you have an alternate match toproduct, which is matching to every product with a ProductFeed. Basically your marketplace match isn't doing anything in your query at all. Didn't you want to work with products within a particular marketplace? Because your query isn't doing that. - InverseFalcon