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

Strip Outer Spaces Of User Search String and Queried DB Fields #3433

Open
wants to merge 1 commit into
base: fix-for-improving-user-search
Choose a base branch
from

Conversation

aaronskiba
Copy link
Contributor

@aaronskiba aaronskiba commented Jun 28, 2024

Changes proposed in this PR:

  • Addresses the following edge-case: Fix for improving user search. #3407 (comment)
  • In addition to applying .squish to the user-inputted search term, .strip is applied as well. For example, if " x " was typed by the user, then a query would be made for "x".
  • Similarly, trim() is applied to the db values for for User.firstname and User.surname. For example, if the value for one of these fields was " x ", then it would be trimmed to "x".

Additional Notes:

  • There is still another edge-case. That is, it is possible for a User.firstname or User.lastname value to exist in the db having multiple spaces in-between non-space characters. In fact, there are two currently in the production db of DMP Assistant:

  • SELECT firstname, lastname
    FROM users
    WHERE trim(firstname) LIKE '%  %' -- Multiple consecutive spaces within string after applying trim
    OR trim(surname) LIKE '%  %';
    -------------------------------
    count: 2
  • It would be great to expand the concept of Fix for improving user search. #3407 to other search bars within the app, but the following issue should probably be addressed first: Address/Prevent DB Strings With Leading, Trailing, or Multiple Consecutive Spaces #3432

For example, if `" x "` was typed by the user, then a query would be made for `"x"`. Also, if a db value for `User.firstname` or `User.surname` was `" x "`, then it would be trimmed to `"x"`.
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.

1 participant