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

Adjusting UsersController#search for agnosticism #4407

Merged
merged 1 commit into from
Jul 1, 2020

Conversation

jeremyf
Copy link
Contributor

@jeremyf jeremyf commented Jul 1, 2020

Prior to this commit, I believe the syntax was less generalize. In
particular, the "field like lower(value)" was suspect. Namely, we were
already downcasing the query, but we weren't telling the field to be
treated as lower case.

I believe in SQLite and Mysql, LIKE clauses are already assumed to be
case agnostic. That is, I think, not the case in Postgresql. In other
words, Postgresql needs to be told whether or not to treat the field as
lower (or upper) case.

With this change, I'm also introducing sanitization of possible "like"
characters as part of the query.

And, I also note that this method has feature envy; That is to say the
method sends lots of messages to ::User, strongly implying that this
method belongs in ::User

@samvera/hyrax-code-reviewers

Prior to this commit, I believe the syntax was less generalize.  In
particular, the "field like lower(value)" was suspect. Namely, we were
already downcasing the query, but we weren't telling the field to be
treated as lower case.

I believe in SQLite and Mysql, LIKE clauses are already assumed to be
case agnostic.  That is, I think, not the case in Postgresql.  In other
words, Postgresql needs to be told whether or not to treat the field as
lower (or upper) case.

With this change, I'm also introducing sanitization of possible "like"
characters as part of the query.

And, I also note that this method has feature envy; That is to say the
method sends lots of messages to `::User`, strongly implying that this
method belongs in `::User`
Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

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

👍 Looks good as far as I can tell.

@jeremyf jeremyf merged commit 259b369 into master Jul 1, 2020
@jeremyf jeremyf deleted the adjusting-users-search branch July 1, 2020 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants