-
Notifications
You must be signed in to change notification settings - Fork 59
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
FILTER documentation #1198
FILTER documentation #1198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. LGTM. Two remarks inline.
Unlike `WHERE`, `FILTER` is not a subclause, which means it can be used independently of the xref:clauses/match.adoc[`MATCH`], xref:clauses/optional-match.adoc[`OPTIONAL MATCH`], and xref:clauses/with.adoc[`WITH`] clauses. | ||
It is not, however, as versatile as `WHERE`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.... I not sure I would say that. Yes there are way to use WHERE which do not work with FILTER. However, this comes from 1) where being a subclause 2) the context in which it is allowed. So, it is a bit of an apple and oranges comparison.
I guess you basically trying to say that they are different in some respects and the user should not think that every WHERE is 1-to-1 replaceable by a FILTER. That is certainly true. But may we can find a way to say that in a neutral way without adding a quality to it.
The main cause of the difference is exactly that FILTER is a clause while WHERE is a subclause (of multiple different clauses).
So, may be like something like this:
Unlike `WHERE`, `FILTER` is not a subclause, which means it can be used independently of the xref:clauses/match.adoc[`MATCH`], xref:clauses/optional-match.adoc[`OPTIONAL MATCH`], and xref:clauses/with.adoc[`WITH`] clauses. | |
It is not, however, as versatile as `WHERE`. | |
Unlike `WHERE`, `FILTER` is not a subclause, which means it can be used independently of the xref:clauses/match.adoc[`MATCH`], xref:clauses/optional-match.adoc[`OPTIONAL MATCH`], and xref:clauses/with.adoc[`WITH`] clauses. | |
Conversely, `FILTER` cannot be used within these clauses like `WHERE` but only next to them. |
While this somewhat fulfils to aim I laid out the top, I am not sure I like for the flow. Anyway. May you have a better idea.
Alternatively, we can also consider dropping the second sentence altogether.
Or turn it into a forward reference to section "FILTER
as a substitute for WITH * WHERE
", like: "For more details on this difference see ..."
RETURN b.name AS name | ||
---- | ||
|
||
For more information about how to use `WHERE` in fixed-length and variable-length pattern matching, see xref:clauses/where.adoc#filter-patterns[`WHERE` -> Filter patterns]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One item you could add is relative to the point the docs makes somewhere that
When used with MATCH and OPTIONAL MATCH, WHERE adds constraints to the patterns described. It should not be seen as a filter after the matching is finished.
This make a different particularly with OPTIONAL MATCH
.
UNWIND [32,37,40] AS age
OPTIONAL MATCH (p:Person)
WHERE p.age = age
RETURN p.name
returns
╒═══════╕
│p.name │
╞═══════╡
│"Susan"│
├───────┤
│null │
├───────┤
│"John" │
└───────┘
while
UNWIND [32,37,40] AS age
OPTIONAL MATCH (p:Person)
FILTER p.age = age
RETURN p.name
returns
╒═══════╕
│p.name │
╞═══════╡
│"Susan"│
├───────┤
│"John" │
└───────┘
Co-authored-by: Hannes Voigt <[email protected]>
Thanks for the documentation updates. The preview documentation has now been torn down - reopening this PR will republish it. |
No description provided.