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

api/search/random Endpoint Sometimes Doesn't Return Amount Requested in count Parameter #1119

Open
hibikikuze4dan opened this issue Nov 27, 2024 · 3 comments

Comments

@hibikikuze4dan
Copy link

hibikikuze4dan commented Nov 27, 2024

LRR Version and OS
Version 0.9.21, "Telling Lies (Paradox mix)" - Synology NAS - Docker

Bug Details
I've noticed when supplying a larger number to the count parameter for the api/search/random endpoint like 63 for example, the amount of archives in the response is sometimes less than the number provided in count like 61 instead of 63. As stated, this only happens sometimes at about a 25-33% rate. It's not exactly a huge deal, I just wanted to bring attention to the fact that this exists.

Matching Logs
Nothing of note in the logs from what I could tell.

Screenshots
Screenshot 2024-11-27 133214
Screenshot 2024-11-27 133139

@Difegue
Copy link
Owner

Difegue commented Dec 10, 2024

If your search query has less total IDs than your count, the API will stop after including every existing result in the random selection.

I can add a recordsTotal parameter to the result to expose this final number if that's helpful.

@hibikikuze4dan
Copy link
Author

If your search query has less total IDs than your count, the API will stop after including every existing result in the random selection.

That makes sense, but the behavior I described was happening even when no search query was being supplied.

@Difegue Difegue reopened this Dec 10, 2024
@Difegue
Copy link
Owner

Difegue commented Dec 10, 2024

I see - Guess it's worth taking a closer look at some point, might be some logic error in the way the server pulls random IDs out of the results?

I can't repro this on my test dataset so it might very well be a weird issue that depends on the content.

@Difegue Difegue added this to the Volunteers welcome milestone Dec 10, 2024
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

No branches or pull requests

2 participants