diff --git a/modules/ROOT/pages/directives/custom-logic.adoc b/modules/ROOT/pages/directives/custom-logic.adoc index a8a0dbc9..38d1e56f 100644 --- a/modules/ROOT/pages/directives/custom-logic.adoc +++ b/modules/ROOT/pages/directives/custom-logic.adoc @@ -20,21 +20,17 @@ Global variables are available for use within the Cypher statement, and can be a a| [source, graphql, indent=0] ---- -{ - Movie { - title - actors: ACTED_IN @this { - role - actor { - name - } - } - directors: DIRECTED @this { - director { - name - } - } - } +type Movie { + title: String + similarMovies(limit: Int = 10): [Movie] + @cypher( + statement: """ + MATCH (this)<-[:ACTED_IN]-(:Actor)-[:ACTED_IN]->(rec:Movie) + WITH rec, COUNT(*) AS score ORDER BY score DESC + RETURN rec LIMIT $limit + """, + columnName: "rec" + ) } ----