Skip to content

Commit

Permalink
fix: offer info cypher query
Browse files Browse the repository at this point in the history
  • Loading branch information
jxhnx committed Nov 6, 2024
1 parent ff65c3e commit f3cf351
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/app/services/query.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,20 @@ export class QueryService {
return `
MATCH (so)
WHERE 'ServiceOffering' IN labels(so) AND id(so) = ${offerId}
CALL apoc.path.subgraphNodes(so, {maxLevel: 7})
YIELD node AS connected
WITH so AS serviceOfferingNode
MATCH (directNode)-[]-(serviceOfferingNode)
WITH serviceOfferingNode, COLLECT(directNode) AS directNodes
MATCH (serviceOfferingNode)<-[*1..2]-(relatedNode)
WITH serviceOfferingNode, directNodes, COLLECT(relatedNode) AS relatedNodes
UNWIND relatedNodes AS relatedNode
MATCH (relatedNode)-[*1..2]->(secondLevelNode)
WITH [serviceOfferingNode] + directNodes + relatedNodes + COLLECT(secondLevelNode) AS allNodes
UNWIND allNodes AS connected
RETURN DISTINCT id(connected) AS id, connected AS value, labels(connected) AS labels
ORDER BY labels(connected), id DESC
LIMIT 100
Expand Down

0 comments on commit f3cf351

Please sign in to comment.