-
Notifications
You must be signed in to change notification settings - Fork 24
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
Case Insensitive search (again) #38
Comments
Hello Diego, thanks for your thoughts on this. I think it is a great solution. However please have a look at the cakephp-datatables/src/Controller/Component/DataTablesComponent.php Lines 233 to 238 in 0db0e58
What you see there is a special case for 'like' comparisons. I think this is where your addition of ignoreCase would fit best. The problem with CONCAT() is that it makes comparisons of non-string types in the database very inefficient (indexes become unusable etc.), so I believe it is best to introduce this functionality only for LIKE-type comparisons. Or we could think of making case-insensitivity a per-column option, as is done with the custom operator. What do you think? |
I will take a look, and yeah im aware of the performance penalty when casting in that way, but at least in my case it was much cleaner than having to add a lot of conditions to do different things depending on the field type. |
Hello there @ypnos-web , i have been working with this code for a while, trying to implement case insensitive search in an elegant way. I think i have found it (finally).
I think its elegant because its pure SQL and should work with all DB engines, as a plus, CONCAT() implies a cast to string, so it will not explode when searching on non string/varchar fields.
I have only tested this on PostgreSQL, but i think it should work in other engines too.
Let me know what you think, and i might send you a PR if you are interested, or you can just copy paste from here.
Thanks!
// Diego
The text was updated successfully, but these errors were encountered: