Am experiencing really strange behavior with the return of records. When I
run this rather long query it splits the response into 2 records and places
null into one of the columns to begin, but then returns the data in the 2nd
record. I cannot see what could be causing this so
// MATCH WHISKY WITH DISTILLERY, COUNTRY, REGION, KEYWORDS AND
FLAVOUR_PROFILE
MATCH (whisky:Whisky {id: {whiskyId}}) WITH whisky
OPTIONAL MATCH (whisky)<-[:PRODUCES]-(distillery:Distillery)-[:FLAVOUR]-(
flavour:Flavour)
OPTIONAL MATCH (whisky)-[:HAS_KEYWORD]->(keyword:Keyword)
OPTIONAL MATCH (whisky)-[:FROM]-(region:Region)-[:IN]-(country:Country)
// MATCH SHOPS THAT SELL THE WHISKY AND IF THEY SHOP TO USERS COUNTRY
OPTIONAL MATCH (whisky)<-[shopInfoA:SELLS]-(shopA:Retailer)
OPTIONAL MATCH (whisky)<-[shopInfoB:SELLS]-(shopB:Retailer)-[shopShippingB:
SHIPSTO]-(:Country)-[:FROM]-(me:User {id: {userId}})
OPTIONAL MATCH (whisky)<-[shopInfoA:SELLS]-(shopA:Retailer)
// MATCH USER TASTING
OPTIONAL MATCH (whisky)<-[myTasting:TASTED]-(me)
// MATCH RECOMMENDED WHISKIES BASED ON WHISKY ID
OPTIONAL MATCH (me2:User {id: {userId}})-[s1:SIMILAR]-(:User)-[t1:TASTED]->(
whisky)
UNWIND (CASE WHEN t1.recommend IS NULL then [0] else t1.recommend end) AS
tastingIds
// MATCH RECOMMENDED WHISKIES FROM ABOVE QUERY AND RETURN WHISKIES
OPTIONAL MATCH (tastingRecommended:Whisky) WHERE tastingRecommended.id =
tastingIds AND tastingRecommended.id <> {whiskyId}
// MATCH RECOMMENDED WHISKIES BASED ON FLAVOUR
OPTIONAL MATCH (me2)-[s2:SIMILAR]-(:User)-[t2:TASTED]-(:Whisky)-[:PRODUCES
]-(:Distillery)-[:FLAVOUR]-(flavour)
UNWIND (CASE WHEN t2.recommend IS NULL then [0] else t2.recommend end) AS
flavourUserIds
// MATCH RECOMMENDED WHISKIES FROM ABOVE QUERY AND RETURN WHISKIES
OPTIONAL MATCH (flavourRecommended:Whisky) WHERE flavourRecommended.id =
flavourUserIds AND flavourRecommended.id <> {whiskyId}
// JOIN QUERIES WITH RETURNS
WITH whisky, flavour, tastingRecommended, flavourRecommended, distillery,
keyword, region, country, shopA, shopInfoA, me, shopShippingB, shopB,
shopInfoB, myTasting,
// RETURN RESULTS
RETURN DISTINCT whisky, flavour as flavourProfile, distillery.name AS
distillery, region.name AS region, country.name AS country,
// RETURN RECOMMENDED WHISKIES IF USER IS LOGGED IN AND SIMILAR USERS HAVE
TASTED THE WHISKY
CASE WHEN tastingRecommended.id IS NULL THEN null else COLLECT(DISTINCT {
name:tastingRecommended.name, id:tastingRecommended.id, img:
tastingRecommended.whisky_img}) END AS tastingRecommended,
// RETURN RECOMMENDED WHISKIES IF USER IS LOGGED IN AND SIMILAR USERS HAVE
TASTED WHISKY WITHIN FLAVOUR PROFILE MATCH
CASE WHEN flavourRecommended.id IS NULL THEN null else COLLECT(DISTINCT {
name:flavourRecommended.name, id:flavourRecommended.id, img:
flavourRecommended.whisky_img}) END AS flavourRecommended,
Here is the return as text so you can see what is going on. in the interest
of sanity, I have shortened the entries down,
╒══════════════════════════════╤══════════════════════════════╤════════════╤══════════╤══════════╤══════════════════════════════╤══════════════════════════════╤
│"whisky" │"flavourProfile"
│"distillery"│"region" │"country" │"tastingRecommended"
│"flavourRecommended |
╞══════════════════════════════╪══════════════════════════════╪════════════╪══════════╪══════════╪══════════════════════════════╪══════════════════════════════╪
│{"floral":1,"testData":"1","pr│{"profile":"A","description":"│"Macallan"
│"Speyside"│"Scotland"│[{"name":"Knockando 21 Year Ol│null
│
│oduct_url":"34.99","distillery│Sherried, malty and spicy, wit│
│ │ │d 1994 Master Reserve Single M│
│
│":"The Macallan","smoky":1,"wh│h nutty and smoky hints","id":│
│ │ │alt Whisky","id":"370","streng│
│
│...... │...... │
│ │ │...... │
│
├──────────────────────────────┼──────────────────────────────┼────────────┼──────────┼──────────┼──────────────────────────────┼──────────────────────────────┼
│{"floral":1,"testData":"1","pr│{"profile":"A","description":"│"Macallan"
│"Speyside"│"Scotland"│[{"name":"Glen Moray 12 Year O│[{"name":"Laphroaig
Select Sin│
│oduct_url":"34.99","distillery│Sherried, malty and spicy, wit│
│ │ │ld Single Malt Whisky","id":"3│gle Malt
Whisky","id":"217","s│
│":"The Macallan","smoky":1,"wh│h nutty and smoky hints","id":│
│ │
│10","strength":6,"img":"http:/│trength":6,"img":"http://cdn1.│
│...... │...... │
│ │ │...... │
│
└──────────────────────────────┴──────────────────────────────┴────────────┴──────────┴──────────┴──────────────────────────────┴──────────────────────────────┴
Started streaming 2 records after 5548 ms and completed after 5550 ms.
Is this a bug I need to report on Github or has the community come across
this before and have a solution?
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.