# Searching Users returns a maximum of 20 users

**URL:** https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485
**Category:** Feature
**Tags:** search
**Created:** [February 23, 2024, 1:50pm UTC](https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485 "2024-02-23T13:50:36Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [February 23, 2024, 1:50pm UTC](https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485/1 "2024-02-23T13:50:36Z")

</div>

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.

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/0/8/3087c36860fd376770f978575d4514ede6baa6d6.png)

I thought this might be related to the [‘hidden’ site setting `DISCOURSE_RATE_LIMIT_SEARCH_USER`](https://meta.discourse.org/t/how-to-edit-hidden-site-settings/194640) 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?

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [March 17, 2024, 10:29pm UTC](https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485/2 "2024-03-17T22:29:47Z")

</div>

I can reproduce that with the username. For example, [https://meta.discourse.org/u?name=M](https://meta.discourse.org/u?name=M) returns only 20 users. But I expect more users at Meta to start with “M”.

---

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [April 16, 2024, 8:33am UTC](https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485/3 "2024-04-16T08:33:11Z")

</div>

Thanks @Moin for the repro.

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?

---

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [September 6, 2024, 12:05pm UTC](https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485/4 "2024-09-06T12:05:57Z")

</div>

Any update on this bug from the Discourse team? Would be great to know if it will be fixed, it has been reproduced here on Meta.

And does anyone know what the [‘hidden’ site setting `DISCOURSE_RATE_LIMIT_SEARCH_USER`](https://meta.discourse.org/t/how-to-edit-hidden-site-settings/194640) does? It’s (AFAICT) not documented anywhere, but seems possibly relevant to this issue.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [September 11, 2024, 8:48am UTC](https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485/5 "2024-09-11T08:48:38Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [September 11, 2024, 11:34am UTC](https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485/7 "2024-09-11T11:34:06Z")

</div>

> [@j.jaffeux](#):
>
> It’s more a feature request than a bug. You want us to implement pagination here.

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.

> [@j.jaffeux](#):
>
> Rate limit is not related to number of results it’s to avoid people spamming the search endpoint.

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.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [September 11, 2024, 11:30pm UTC](https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485/8 "2024-09-11T23:30:57Z")

</div>

> [@pacharanero](#):
>
> 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.

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.

---

<div class="post-metadata">

### Author: ![lindsey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lindsey/32/318210_2.png) [@lindsey](https://meta.discourse.org/u/lindsey)
#### Post date: [October 11, 2024, 3:49pm UTC](https://meta.discourse.org/t/searching-users-returns-a-maximum-of-20-users/296485/16 "2024-10-11T15:49:08Z")

</div>

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.
