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 number of text matches returned in search #1327

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

LukasKalbertodt
Copy link
Member

This is the last thing required for 3.0 as far as I can tell. See commits for more information.

Previously (especially before using stop words), the search endpoint
could return a vast number of text matches, slowing down network and
frontend. This slow down needs to be avoided and, in those cases, seeing
all the individual matches is not useful anyway. So we reduce the number
of returned matches to a limit, without changing the "general look of
the timeline" too much. See comments for more details.
The backend now returns them in sorted order already. And the frontend
sorting mix slide-texts and captions, which lead to weird z-index
issues.
This helps shrink GraphQL search responses a bit, makes queries less
repetitive (no need to specify `start end` all the time), generally
saves processing time (fewer JSON objects) and avoids having to use
signed integers. In an example request, it shrank the response size
from 210 to 190KB. Not a ton but still 10%.
@LukasKalbertodt LukasKalbertodt added the changelog:nope Not worth mentioning in the changelog label Feb 4, 2025
@github-actions github-actions bot temporarily deployed to test-deployment-pr1327 February 4, 2025 12:55 Destroyed
Copy link
Member

@owi92 owi92 left a comment

Choose a reason for hiding this comment

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

This is working well and the code looks reasonable to me. I didn't see a noticable difference in performance, but I also didn't look at exact times, just going by feel.

At any rate, even without looking considering performance, I think it's quite useful to limit the results shown in the timeline (maybe a limit of 20 is even somewhat high, but I'd keep that for now).

@owi92 owi92 merged commit 4d0c27f into elan-ev:next Feb 4, 2025
4 checks passed
@LukasKalbertodt LukasKalbertodt deleted the reduce-match-count branch February 4, 2025 17:14
@LukasKalbertodt
Copy link
Member Author

I didn't see a noticable difference in performance

I also couldn't find any terrible example of many hundreds of matches anymore after we merged the stop words thing. This PR is just a "backup" just to make sure these fringe cases never happen and slow down the frontend too much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:nope Not worth mentioning in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants