Having trouble with "Search This Topic"

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.

4 Likes

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.

The “no results” text is missing on Meta as well.

3 Likes

I can reproduce a consistent bug that is likely related.

On this topic. Type “happen” … you find stuff. Keep typing " frog"… results don’t change.

Type “happen frog” quickly:

Of course now the word frog is indexed, just substitute with another word that does not exist.

@dan could this regression be a result of the new search refactoring we did recently?

5 Likes

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.

2 Likes

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:

and then nudged in:

I fixed it in and will be available to update after review:

4 Likes

fix is now deployed on meta, @simon / @Slowhand are you able to reproduce any issues here?

1 Like

Not seeing it here on Meta.

:crossed_fingers:

2 Likes