When searching users by Searchable user custom field values, there is only ever a maximum of 20 results returned, even though I know from Rails console queries that there are around 200.
I thought this might be related to the ‘hidden’ site setting DISCOURSE_RATE_LIMIT_SEARCH_USER which I have amended to 50, but although this env var did get recognised and was contained in the final block from the ./launcher rebuild app output, there is no change. I am guessing that this setting is more to do with rate limiting than the number of search results returned (although searching Meta and the Discourse source I couldn’t find any documentation of this setting at all)
Is this limit of 20 an internal Discourse limit? Is there a way to change it?
I can reproduce that with the username. For example, https://meta.discourse.org/u?name=M returns only 20 users. But I expect more users at Meta to start with “M”.
Is there anything I can do about this 20-user limitation in searching? The forum team which raised this issue want to be able to use the search to find other people with similar research interests. At the moment, the seemingly arbitrary limitation prevents the search being much use for this.
This limit of 20 has to be a setting somewhere, surely?
It’s more a feature request than a bug. You want us to implement pagination here.
Rate limit is not related to number of results it’s to avoid people spamming the search endpoint.
So if you search for a term and 200 users match that, it will only show you the first 20 and there is no way to see the others. That’s at best an incomplete feature. It just doesn’t seem to match how other features in Discourse work.
Also, as it’s undocumented that there is this hard stop at 20, for no clear reason, then yes it would seem more like a bug or an oversight than anything else. I can’t imagine someone implementing any search feature and consciously deciding to include an arbitrary and completely fixed limit to the number of results you can get.
Yes, I figured rate limit different to number of results, but it was the only setting I could find anywhere that seemed to possibly have any relevance.
It’s not very hard to imagine though. Implementing pagination both in backend and frontend is a significant amount of work. If providing this feature has never been requested then other things get prioritized. Many things taken alone are easy, but when you have thousands things to do; you have choices to make.
We’re planning to improve both the general search and the directory search to return all results instead of limiting to the first 20 results — however, at this point I do not know when we’ll complete this work so I will leave this topic open to see if this is a more widely experienced painpoint that we need to prioritize more urgently.