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

Missing level of indentations an sub-queries and where clauses #74

Open
reckter opened this issue Jun 21, 2023 · 0 comments
Open

Missing level of indentations an sub-queries and where clauses #74

reckter opened this issue Jun 21, 2023 · 0 comments

Comments

@reckter
Copy link

reckter commented Jun 21, 2023

Hey, thanks for the plugin!

I've noticed that sub queries and where clauses, do not get correctly intended. (at least in my opinion).

Example:

MATCH (subject:User)
	WHERE (subject.id = $subjectId) OR (subject.openId = $subjectId)
CALL {
WITH subject
CALL apoc.path.expandConfig(subject, {relationshipFilter: 'IS_IN',
									  labelFilter:        '/User',
									  uniqueness:         'NODE_GLOBAL'}) YIELD path

WITH nodes(path) AS nodes
UNWIND nodes AS n

WITH n
	WHERE
	(n.id = $userId) AND
	'User' IN labels(n)

RETURN n AS s
UNION
WITH subject
RETURN subject AS s
}
WITH s
	WHERE s.id = $userId
RETURN s

imo it should look like this:

MATCH (subject:User)
	WHERE (subject.id = $subjectId) OR (subject.openId = $subjectId)
CALL {
	WITH subject
	CALL apoc.path.expandConfig(subject, {
		relationshipFilter: 'IS_IN', 
		labelFilter:        '/User',
		uniqueness:         'NODE_GLOBAL'
	}) YIELD path


	WITH nodes(path) AS nodes
	UNWIND nodes AS n

	WITH n
		WHERE
			(n.id = $userId) AND
			'User' IN labels(n)

	RETURN n AS s
	UNION
	WITH subject
	RETURN subject AS s
}
WITH s
	WHERE s.id = $userId
RETURN s

(not sure on the apoc, call, no strong opinion there). The CALL {...} expresson and the WHERE expression should add an intendation imo

@reckter reckter changed the title Missing level of intendations an sub-queries and where clauses Missing level of indentations an sub-queries and where clauses Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant