Maximum Number of Search Results?


Just wondered whether there is a maximum number of search results being set in the background of Discourse at all?

I wanted to see how many of the automated topics we have that are created have any responses, I found 305 that do not, but I wanted to find the total number of the automated posts (they all begin with the same text). After scrolling for some time, no more were loaded and the count was exactly 500 - this felt too neat to be by chance.

I’ve looked through the admin settings for both “search” and “500” and I didn’t see anything which looked like a limit on the number of returned results.

Any information would be appreciated :slight_smile:

Yup, it’s capped at 500 :slight_smile:


Hi @HAWK, thanks for the reply.

Is there anything that I can add in the search criteria or to a querystring to bypass the limit?

Kind regards


Not really, we do this here to protect the server, search becomes very expensive when you are paging through enormous amounts of topics, the offset keeps on costing more and more.


Why would you need more than 500 results? Who exactly is going to page 13 of search results?


It’s not a really a feature I am asking for - as such - I just wondered whether you had something like this in the background, almost like a debugging feature.

It isn’t something I would want to do every day, its just in this specific case I am trying to establish how many automated topics have been created, and, from those, how many have actually been replied to.

I have the number that are not replied to, 305, but what I don’t know is how many have been created altogether. If for example it was 400, then that would suggest the process of generating automated topics is a bit pointless, as they are not being used. If however it was 1,500, then that would be a little different.

Because the search stops at 500 results I am unable to determine this.

I am wondering whether perhaps I can use the date fields to get a series of mini-counts as it were, and then total them all up afterwards.

As I say, it was really just a one-time thing, not something I would need specific functionality for within the software itself, just wondered whether you had a little work-around for those times when perhaps you yourselves need it, but I guess you’d just query the database directly.

So all you need is the count not the actual results?


Yeah, pretty much, was just using the tools at my disposal.

If I could get a break down of the category / sub-category with their counts that would be useful, but not essential as if it comes to me having to delete them I will be going through category after category - just helps to have a bit of a work list.

The decision on removal is still to be made but I thought if I could present the figures then it would perhaps help.

Doesn’t matter if this isn’t possible, as I say I may be able to use the date range filters and and just repeat the searches changing the ranges each time until complete, just a bit of a pain :slight_smile:

Could you use a Data Explorer query to get the exact count?


I’ve nevered used them Joshua, where/how would I begin?

I have come from / been spoilt by direct access to SQL databases in the past, so pinging off the odd query here and there when needed was fairly straight forward - obviously now I’m on the other side of that fence :slight_smile:

Data Explorer very likely what you’re looking for then! It allows you to write SQL queries against the database. You can see the basics in the Data Explorer Plugin topic. In short, visit your plugins page and enable it. Then you’ll see Data Explorer as a tab on the left site of the page. From there, just write the queries you need!

You may also wish to review What cool data explorer queries have you come up with? if you would like to see some sample queries.


oooh, now I think I may have stumbled across this, or something like this before, but then realised I wasn’t able to do it. Isn’t the ability to write these queries only for non-hosted customers? Ours is a hosted solution and I thought I saw/read before that this functionality wasn’t available to us. I would be happy to be wrong :slight_smile:

/runs off…

/runs back…

Ooooh… looks like I can enable it!

Ok, thanks for this, I will have a dabble tomorrow and see what I can work out, and thanks for the link to the other post :slight_smile:


This is exactly what I needed - thank you so much for the heads up on this one.

I am of course desperately trying to remember all of the SQL syntax that used to roll off of the finger tips a couple years ago.

Please feel free to close this topic and thanks again :slight_smile: