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

fix(server): /search/random API returns same assets every call #15682

Merged
merged 2 commits into from
Jan 26, 2025

Conversation

sudbrack
Copy link
Contributor

Fixes:

#15647

Changes made:

  • Modified SQL QueryBuilder code to use Postgre's built-in RANDOM() function for ordering instead of asset.id. Ordering by asset.id returned the same asset images every time instead of being random. I checked the searchRandom controller and it runs the SQL query and then directly returns the results, so no double randomization logic is going on.

Immich Kiosk & searchRandom API endpoint is now working again with this change

@alextran1502 alextran1502 enabled auto-merge (squash) January 26, 2025 13:55
@alextran1502 alextran1502 merged commit 2064122 into immich-app:main Jan 26, 2025
33 checks passed
@sudbrack sudbrack deleted the fix/server-searchrandom branch January 26, 2025 14:07
Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

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

This does a full table scan and isn't a viable solution IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants