neo4j-graphql-js icon indicating copy to clipboard operation
neo4j-graphql-js copied to clipboard

Support for case insensitive search using the augmented filters

Open vijayst opened this issue 5 years ago • 6 comments

When I use the following query, the search is not case sensitive. For example, I want to search for "New Arrivals" or "new arrivals", But that is not possible now. Any solutions or workarounds?

I have an ugly workaround which is to duplicate the field (tagslower whose values are all lowercase characters). But looking for a scalable solution.

gql`
    query($tag: String!) {
        Product(filter: { tags_contains: $tag }) {
            title
        }
    }
`;

vijayst avatar Jun 03 '19 16:06 vijayst

Classic case-insensitive searching is to simply downcase both the field and the query string on comparison.

Joshfindit avatar Jun 03 '19 19:06 Joshfindit

@Joshfindit And how should be that fact helpful in this case? Because there seems to be no way to control downcasing within generated resolvers, amirite?

The huge issue here is that all the generated String filters are completely useless in real case scenarios since they are case sensitive.

+1 to controlling this through makeAugmentedSchema config.

smajl avatar Aug 03 '19 16:08 smajl

@smajl

@Joshfindit And how should be that fact helpful in this case? Because there seems to be no way to control downcasing within generated resolvers, amirite?

The huge issue here is that all the generated String filters are completely useless in real case scenarios since they are case sensitive.

+1 to controlling this through makeAugmentedSchema config.

By "+1 to controlling this through makeAugmentedSchema config." you mean you managed to do it? We're trying to get around this issue...

fguille94 avatar Oct 08 '20 23:10 fguille94

@fguille94 No, I meant that it should be ideally configurable via the makeAugmentedSchema config, where you should be able to toggle case insensitive search to make it usable in real apps. Sadly can't help you more, because we are not using this lib anymore (guess why).

smajl avatar Oct 09 '20 14:10 smajl

@smajl yeah that would certainly add more value to the lib... We have tried adding a "searchString" prop to some entities with some of the most important prop strings separated by blank space, and in lower case, so we can just do "searchString_contains" and be done with it, but that isn't the most optimal way. Also using @cypher to do it eliminates the field from the filter options so it isn't usable there.

Would you care to point me in the direction you took in order fulfill this app requirement?

fguille94 avatar Oct 09 '20 15:10 fguille94

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608

michaeldgraham avatar May 02 '21 04:05 michaeldgraham