Closed hurali97 closed 4 years ago
Hi @hurali97
Thanks for raising the issue. It looks like the backend cluster, for some reason, no longer returns results for the sampling query in the case when there are no other input fields. When there are other input fields it works fine, eg:
https://poetrydb.org/author,random/Shakespeare;3
The cluster was migrated to a different provider last week, which may have someting to do with it. However this issue didn't come up during tests, so looks like a degradation of some sort. Nevertheless, no cluster or database issues are being reported.
Mongo random sampling can have performance implications in some situations. So rather than rely on the backend I've updated the sampling method to use aggregation instead.
Seems to do the trick, but let me know if it happens again.
Thank you very much for such quick response.
https://poetrydb.org/author,random/Shelley;3
The above URL seems to still yield the application error
Thanks for spotting, @serenag01. It looks like sampling over 'long' poems (like Shelley's) causes a kind of timeout in the backend. I've now moved all sampling to the aggregate method, which is more efficient.
This should hopefully allow all random searches to return within a reasonable timeframe.
Hi maintainers! This API is really great. There's this issue when getting the random/4 or any number after random. However, random/ works fine but random/4 or any number throws the attached error. It was working fine a couple of weeks ago.