Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimised Cypher queries in Neo4j example #25973

Merged
merged 10 commits into from
Jul 19, 2021
Merged

Conversation

adam-cowley
Copy link
Contributor

Thank you for including a Neo4j example!

This PR rewrites the Cypher queries using a pattern comprehension which will make them more performant and removes the need for the collect(DISTINCT ...) step.

@ijjk ijjk added the examples Issue/PR related to examples label Jun 10, 2021
Copy link
Member

@leerob leerob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after that!

@adam-cowley
Copy link
Contributor Author

I realised a mistake with how the numbers were handled in the front end. There is a gotcha when it comes to JavaScript integers and Neo4j (Java) integers.

Using disableLosslessIntegers with instantiating the driver solves the problem in this use case. In 90% of cases, this workaround will be fine, if the integer happens to be a BigInteger in this case then the number is converted to a string. Either way it'll be handled the same way by the UI.

@adam-cowley adam-cowley requested a review from leerob July 5, 2021 13:48
leerob
leerob previously approved these changes Jul 5, 2021
@kodiakhq kodiakhq bot requested review from huozhi, padmaia and styfle as code owners July 5, 2021 17:40
Copy link
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@kodiakhq kodiakhq bot merged commit 9774d9b into vercel:canary Jul 19, 2021
flybayer pushed a commit to blitz-js/next.js that referenced this pull request Aug 19, 2021
Thank you for including a Neo4j example!

This PR rewrites the Cypher queries using a [pattern comprehension](https://neo4j.com/docs/cypher-manual/current/syntax/lists/#cypher-pattern-comprehension) which will make them more performant and removes the need for the `collect(DISTINCT ...)` step.
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants