Users reported a bug with the “Search This Topic” feature on Discourse forums, where toggling the option inconsistently fails to limit searches to the current topic, instead defaulting to site-wide results. Additionally, the search interface no longer displays “no results” when queries return nothing — it simply shows a blank box. Slowhand first described the issue, noting it occurs intermittently despite refreshing or re-logging in. simon confirmed similar behavior on Discourse Meta. sam reproduced a related bug: typing a phrase like “happen frog” doesn’t update results unless typed quickly, suggesting indexing or query handling issues. dan suspected the bug stemmed from recent search refactoring and traced it to a function that improperly discarded return values and mishandled empty results. He submitted a fix in pull request #13604, which was later deployed to Meta. sam confirmed the fix, and Slowhand verified it no longer occurs on Meta, expressing cautious optimism.
I searched several threads, but most of them were locked or weren’t really relevant.
I use the search on our forum to look up anime titles. I usually do a site-wide search first, then do a “search this topic” in our general news thread.
Although it doesn’t happen every single time, lately, it will not change to the topic. IN the example below, I’m actually in the General Anime News thread, and have clicked “Search This Topic”, but it won’t search the topic, only the whole forum.
I’ve tried refreshing the screen and even logged out and back in.
Could this mean that there are no results? And although that’s a separate thing, I’ve also noticed that the search box no longer says “no results” when there aren’t any, it just stays blank.
I’m finding similar results on the Discourse Meta forum to what you are finding on your site. The behaviour of the “search this topic” checkbox seems to be inconsistent. Sometimes toggling the checkbox works and sometimes it only shows site-wide results when toggled. I haven’t found a pattern yet for what is causing the issue.
I think it can be. I was under the impression that I fixed a very similar bug when I did the refactoring (there was a promise we did not wait for). I will have a look.
This a nice catch. We had another bug in that area: a function was called and the return value was discarded. That was a mistake and I made it use the result, but it turns out that the function is buggy and it does not handle empty results. It was originally introduced in: