neo4j / sdn-rx

Nextgen Spring Data module for Neo4j supporting (not only) reactive data access and immutable support
https://neo4j.github.io/sdn-rx
Apache License 2.0
65 stars 23 forks source link

OR condition is missing after AND group... #174

Closed romain-rossi closed 4 years ago

romain-rossi commented 4 years ago

Environment

Description Expected clause WHERE:

...
WHERE 
    (NOT r:LastResume) AND 
    (((COALESCE(o.valid_only, false) = false) AND NOT r:InvalidStatus) OR (o.valid_only AND r:InvalidStatus)) AND ...
...

Code to produce the clause:

   @Test
    void or() {
        var r = node("Resume").named("r");
        var o = node("Offer").named("o");

        var s = match(r.relationshipTo(o, "FOR"))
            .where(r.hasLabels("LastResume").not())
            .and(coalesce(o.property("valid_only"), literalFalse()).isEqualTo(literalFalse())
                .and(r.hasLabels("InvalidStatus").not())
                .or(o.property("valid_only").isTrue()
                    .and(r.hasLabels("InvalidStatus"))))
            .returningDistinct(r, o)
            .build();

        System.out.println(Renderer.getDefaultRenderer().render(s));
    }

Result:

WHERE 
  (NOT (r:`LastResume`) AND 
  coalesce(o.valid_only, false) = false AND NOT (r:`InvalidStatus`) AND (o.valid_only = true AND r:`InvalidStatus`))...

Get .. AND (o.valid_only... instead of .. OR (o.valid_only.... FYI, if I keep only one condition before the OR, it will be in the output result.

Did I get it wrong? Thanks