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

Custom cypher scalar field filtering #5553

Merged
merged 17 commits into from
Sep 12, 2024

Conversation

mjfwebb
Copy link
Contributor

@mjfwebb mjfwebb commented Sep 11, 2024

Description

This PR adds the ability to filter on scalar custom cypher fields. A contrived example:

Type definitions:

type Thing {
    name: String
    custom_count: Int
        @cypher(
            statement: """
            MATCH (m:${CustomType})
            RETURN count(m) as c
            """
            columnName: "c"
        )
}

You can now query with a filter based on the custom_count field:

query {
    things(where: { custom_count_GT: 0 }) {
        name
        custom_count
    }
}

Complexity

Medium

Issue

Relates to #554, but not fully closing as this does not include list/relationship fields.

Closes

Checklist

The following requirements should have been met (depending on the changes in the branch):

  • Documentation has been updated
  • TCK tests have been updated
  • Integration tests have been updated
  • Example applications have been updated
  • New files have copyright header
  • CLA (https://neo4j.com/developer/cla/) has been signed

Copy link

changeset-bot bot commented Sep 11, 2024

🦋 Changeset detected

Latest commit: 3334cb7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@neo4j/graphql Minor
@neo4j/graphql-ogm Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@neo4j-team-graphql
Copy link
Collaborator

neo4j-team-graphql commented Sep 11, 2024

Performance Report

No Performance Changes

Show Full Table
name dbHits old dbHits time (ms) old time (ms) maxRows
aggregations.TopLevelAggregate 3404 3404 37 43 1134
aggregations.TopLevelAggregateWithMultipleFields 6802 6802 52 67 1134
aggregations.NestedAggregation 15407 15407 56 89 2174
aggregations.AggregationWithWhere 10833 10833 40 55 2174
aggregations.AggregationWhereWithinNestedRelationships 20097917 20097917 2060 2194 2008534
aggregations.AggregationWhereWithinNestedConnections 20097917 20097917 2131 2201 2008534
aggregations.NestedCountFromMovieToActors 8603 8603 41 44 2174
aggregations.NestedCountFromActorsToMovie 8791 8791 37 41 2174
aggregations.DeeplyNestedCount 10052335 10052335 2806 3040 2008534
aggregations.InterfacesAggregations 6242 6242 44 51 2080
aggregations.InterfacesAggregationsWithTwoFields 11444 11444 82 90 2080
batch-create.BatchCreate 4200 4200 124 160 600
batch-create.BatchCreateSmall 77 77 53 66 11
connect.createAndConnect 6433 6433 129 171 3003
connections.Connection 12951 12951 70 83 2174
connections.NestedConnection 37705 37705 244 138 4516
create.SimpleMutation 7 7 70 74 1
cypher-directive.TopLevelMutationDirective 1135 1135 27 28 1134
delete.SimpleDelete 19401 19401 657 653 1040
delete.NestedDeleteInUpdate 16844 16844 125 185 2040
2871.NestedRelationshipFilter 19735 19632 61 68 4428
2925.SingleRelationshipFilter 5245 5245 39 53 1040
2925.NestedSingleRelationshipFilter 17641 17641 71 92 2174
2925.SingleRelationshipRequiredFilter 5201 5201 38 43 1040
2925.NestedSingleRelationshipRequiredFilter 9361 9361 56 67 1040
query.SimpleQuery 3121 3121 22 25 1040
query.SimpleQueryWithRelationship 15031 15031 43 40 2174
query.QueryWhere 8564 8564 37 51 2154
query.SimpleQueryWithNestedWhere 8713 8713 48 59 2154
query.Nested 10084891 10084891 7134 7069 2008534
query.NestedWithFilter 10064992 10064992 7208 6586 2004000
query.OrFilterOnRelationships 37420 36551 148 191 2171
query.OrFilterOnRelationshipsAndNested 27505 26982 194 214 2171
query.QueryWithNestedIn 14948 14216 48 71 2116
query.NestedConnectionWhere 8703 8703 51 60 2174
query.DeeplyNestedConnectionWhere 8793 8702 69 86 2174
query.DeeplyNestedWithRelationshipFilters 17489 17357 142 162 1596
query.NestedWithRelationshipSingleFilters 3808 3808 143 174 1134
query.Fulltext 64 64 32 35 16
query.FulltextWithNestedQuery 516 516 42 48 84
sorting-and-cypher.TopLevelSortWithCypher 12961 12961 39 45 2174
sorting-and-cypher.TopLevelConnectionSortWithCypher 12961 12961 58 70 2174
sorting-and-cypher.TopLevelSortWithCypherWithNested 13096 13096 56 61 2174
sorting-and-cypher.TopLevelConnectionSortWithCypherWithNested 13096 13096 94 104 2174
sorting-and-cypher.TopLevelSortWithExpensiveCypher 13658 13705 93 120 2174
sorting-and-cypher.TopLevelConnectionSortWithExpensiveCypher 13266 13266 96 124 2174
sorting.SortMultipleTypes 3436 3436 78 107 1040
sorting.SortMultipleTypesWithCypherWithCypher 13321 13321 99 128 2174
sorting.SortOnNestedFields 12951 12951 45 66 2174
sorting.SortDeeplyNestedFields 39785 39785 81 133 4516
sorting.ConnectionWithSort 3271 3271 70 77 1040
unions.SimpleUnionQuery 321 321 52 60 35
unions.SimpleUnionQueryWithMissingFields 293 293 51 58 35
unions.NestedUnion 309975 309975 275 307 33033
unions.NestedUnionWithMissingFields 283949 283949 251 254 33033
update.NestedUpdate 14137 14137 107 108 2002

Old Schema Generation: 28.733s
Schema Generation: 28.772s
Old Subgraph Schema Generation: 30.869s
Subgraph Schema Generation: 30.148s

@mjfwebb mjfwebb merged commit 35fc0ed into neo4j:dev Sep 12, 2024
80 checks passed
@mjfwebb mjfwebb deleted the feat/cypher-field-filtering branch September 12, 2024 13:59
This was referenced Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants