-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Postgre: Culture is case sensitive #14810
Comments
Please steps to reproduce |
@hishamco GraphQL: |
How is this related to GraphQL? |
I think it is not related to graphql at all, most likely it will be a problem either with case sensitivity in postgre or filter implementation for localization part |
I will test this today and push a PR for the fix |
btw. this seems to apply to all searches - also text/title search is case sensitive |
Could try to create a |
Okay, I tried following:
1/ culture picker (LocalizedContentItemIndex) behaves OK. I guess for search, we need to use "ILIKE" instead.
There are some other options.. https://aws.amazon.com/blogs/database/manage-case-insensitive-data-in-postgresql/ @sebastienros Is this issue even related to OC, or should I move it to yessql repo? |
I tried this CITEXT data type as mentioned in link to amazon above. https://www.postgresql.org/docs/current/citext.html#CITEXT-LIMITATIONS
This seems to work also with LIKE, but you cannot use case sensitive searches when you use this datatype. I think it is not an issue as we use only case insensitive search in other database providers. Another problem might be no length limit and slower execution? There might be another option using indexes... https://coderwall.com/p/6yhsuq/improve-case-insensitive-queries-in-postgres-using-smarter-indexes |
I think we should handle any collation you decide to use, and this property should be stored normalized (lower-case for instance). But if this is impacting too many features we might expect the collation to be case insensitive. |
So you suggest to normalize values to lowercase in application? I think that will have impact on all indexes - it has to be handled on every place where data is stored into index, so I guess mostly in index handlers + on every user input (search bar etc.) + might have impact on existing custom integrations e.g. via graphql. I am okay with that, but it seems complicated at this point. I would probably prefer to update yessql logic for postgre, as there are some other problems anyway. I have found out that also modifying column size breaks migrations in postgre, so it maybe should be revisited completely.. |
Can you please provide a little guidance so I could implement it and create a PR? |
For the culture code we should store it normalized, so everywhere we set it we should For the DisplayText search it's a collation issue. If we use the field directly then there is nothing we can do in OC, just configure the DB with that in mind. Or use a default case-insensitive collation when creating the DB. Or if we want orchard to behave in a consistent way whatever the collation then we should do it in the ContentItemIndex too and the search queries. If we need more than that then it's borderline a search engine issue and we should not use SQL queries for these kind of searches. (talking about DisplayText). |
Okay, I will try to make PR on this |
After migration from SQLite to PostgreSQL database, Culture became case sensitive.
I have found (so far) 2 issues:
1/ GraphQL now requires lowercased language - "en-gb" instead of "en-GB"
2/ culture filter in content items uses "en-GB" for search, but nothing is found unless you type in "en-gb"
not sure what is correct solution, but maybe culture should be stored in original format, not lowercase
The text was updated successfully, but these errors were encountered: