Skip to content

Add caseInsensitive field on string filters #6200

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

Conversation

angrykoala
Copy link
Member

Description

Add support for case insensitive string filters. These can be enabled with the option CASE_INSENSITIVE in features:

const neoSchema = new Neo4jGraphQL({
    features: {
        filters: {
            String: {
                CASE_INSENSITIVE: true,
            },
        },
    },
});

This enables the field caseInsensitive on string filters:

query {
    movies(where: { title: { caseInsensitive: { eq: "the matrix" } } }) {
        title
    }
}

This generates the following Cypher:

MATCH (this:Movie)
WHERE toLower(this.title) = toLower($param0)
RETURN this { .title } AS this

Copy link

changeset-bot bot commented Apr 11, 2025

🦋 Changeset detected

Latest commit: 8bf3013

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

This PR includes changesets to release 1 package
Name Type
@neo4j/graphql 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

@angrykoala angrykoala marked this pull request as ready for review April 22, 2025 15:37
@neo4j-team-graphql
Copy link
Collaborator

neo4j-team-graphql commented Apr 24, 2025

Performance Report

name dbHits old dbHits time (ms) old time (ms) maxRows
❌ update.NestedUpdate [ERROR] N/A N/A N/A N/A N/A

🟥 - Performance worsened (dbHits)
🟩 - Performance improved (dbHits)
🟦 - New test

Show Full Table
name dbHits old dbHits time (ms) old time (ms) maxRows
aggregations.TopLevelAggregateWithMultipleFields 7936 7936 72 72 1134
aggregations.NestedAggregation 15407 15407 66 104 2174
aggregations.AggregationWithWhere 10833 10833 51 59 2174
aggregations.AggregationWhereWithinNestedRelationships 20097917 20097917 1862 1947 2008534
aggregations.AggregationWhereWithinNestedConnections 20097917 20097917 1886 1935 2008534
aggregations.DeeplyNestedCount 10052335 10052335 4167 4149 2008534
aggregations.InterfacesAggregations 8324 8324 84 93 2080
aggregations.InterfacesAggregationsWithTwoFields 13526 13526 112 240 2080
batch-create.BatchCreate 3600 3600 96 76 600
batch-create.BatchCreateSmall 66 66 30 34 11
connect.createAndConnect 4411 4411 87 103 1134
connections.Connection 12951 12951 57 79 2174
connections.NestedConnection 37705 37705 115 133 4516
create.SimpleMutation 6 6 28 34 1
cypher-directive.TopLevelMutationDirective 1135 1135 25 29 1134
delete.SimpleDelete 19401 19401 630 666 1040
delete.NestedDeleteInUpdate 14688 14688 91 154 1183
2871.NestedRelationshipFilter 19632 19632 56 65 4395
query.SimpleQuery 3121 3121 21 26 1040
query.SimpleQueryWithRelationship 15031 15031 42 46 2174
query.QueryWhere 8564 8564 32 46 2154
query.SimpleQueryWithNestedWhere 8713 8713 53 64 2154
query.Nested 10084891 10084891 6363 6295 2008534
query.OrFilterOnRelationships 36664 36427 146 173 1933
query.OrFilterOnRelationshipsAndNested 26653 26462 184 221 1933
query.QueryWithNestedIn 14126 14120 56 67 1842
query.NestedConnectionWhere 8703 8703 53 61 2174
query.DeeplyNestedConnectionWhere 8702 8702 75 87 2174
query.DeeplyNestedWithRelationshipFilters 17357 17357 122 175 1552
query.NestedWithRelationshipSingleFilters 3808 3808 141 198 1134
query.Fulltext 80 80 109 60 16
query.FulltextWithNestedQuery 516 516 66 71 84
sorting-and-cypher.TopLevelSortWithCypher 12961 12961 41 48 2174
sorting-and-cypher.TopLevelConnectionSortWithCypher 12961 12961 61 69 2174
sorting-and-cypher.TopLevelSortWithCypherWithNested 13096 13096 60 62 2174
sorting-and-cypher.TopLevelConnectionSortWithCypherWithNested 13096 13096 93 105 2174
sorting-and-cypher.TopLevelSortWithExpensiveCypher 13720 13720 113 128 2174
sorting-and-cypher.TopLevelConnectionSortWithExpensiveCypher 13266 13266 95 130 2174
sorting.SortMultipleTypes 3436 3436 87 108 1040
sorting.SortMultipleTypesWithCypherWithCypher 13321 13321 100 112 2174
sorting.SortOnNestedFields 12951 12951 43 50 2174
sorting.SortDeeplyNestedFields 39785 39785 87 94 4516
sorting.ConnectionWithSort 3271 3271 75 89 1040
unions.SimpleUnionQuery 321 321 58 64 35
unions.SimpleUnionQueryWithMissingFields 293 293 67 64 35
unions.NestedUnion 309975 309975 262 274 33033
unions.NestedUnionWithMissingFields 283949 283949 253 264 33033
❌ update.NestedUpdate [ERROR] N/A N/A N/A N/A N/A

Old Schema Generation: 26.364s
Schema Generation: 26.076s
Old Subgraph Schema Generation: 30.527s
Subgraph Schema Generation: 29.705s

@angrykoala angrykoala requested a review from mjfwebb April 25, 2025 09:23
Copy link
Contributor

@mjfwebb mjfwebb left a comment

Choose a reason for hiding this comment

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

🎉

@angrykoala angrykoala merged commit 53f794a into dev Apr 28, 2025
41 checks passed
@angrykoala angrykoala deleted the 4827-add-new-filters-for-string-types-to-enable-case-insensitive-filtering branch April 28, 2025 07:38
@andreloeffelmann
Copy link

hey @angrykoala , just wondering wether this has been released? Since #6200 is merged I was assuming so, but #6250 is still open... I am confused :D

@angrykoala
Copy link
Member Author

Hi @andreloeffelmann
Sorry for confusion, we had a conversation within the team about the desired API for case insensitive and a few questions about the API were raised. We want to address them before merging the feature, so it is now behind a feature flag (the PR #6250 removes that flag to enable the feature)

We want to make sure this new feature melds well with the new changes to the API v7 and doesn't require future breaking changes so we are taking it slow to make sure of that

The feature will probably be released mid may for version 7. Thanks for your patience 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new filters for String types to enable case-insensitive filtering
4 participants