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

Limit size of user directory search queries #18172

Merged
merged 3 commits into from
Feb 17, 2025
Merged

Conversation

erikjohnston
Copy link
Member

If a user search has many words we can end up creating really large queries that take a long time for the database to process. Generally, such searches don't return any results anyway (due to limits on user ID and display name length).

We "fix" this by cheating and only searching for the first ten words.

If a user search has many words we can end up creating really large
queries that take a long time for the database to process. Generally,
such searches don't return any results anyway (due to limits on user ID
and display name length).

We "fix" this by cheating and only searching for the first ten words.
@erikjohnston erikjohnston marked this pull request as ready for review February 17, 2025 14:44
@erikjohnston erikjohnston requested a review from a team as a code owner February 17, 2025 14:44
Comment on lines +1243 to +1246
# We limit how many terms we include, as otherwise it can use
# excessive database time if people accidentally search for large
# strings.
break
Copy link
Contributor

Choose a reason for hiding this comment

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

10 words definitely seems reasonable as a 10 word display name seems pretty insane at-least for English. For the examples you saw that prompted this work, was it just English copy-pasta mistakes?

And someone can still search for full user ID's as they don't have any spaces.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it was a russian copy-pasta, but yes.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@erikjohnston erikjohnston merged commit 0c31783 into develop Feb 17, 2025
37 of 39 checks passed
@erikjohnston erikjohnston deleted the erikj/user_dir_perf branch February 17, 2025 15:39
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.

None yet

2 participants