Search Parameters Removed On Search

AI-generated summary

In a bug report titled “Search Parameters Removed On Search,” alexs reports that since version 1.8, search parameters like group:[group name] and @username disappear from the search bar and query summary after executing a search — though they still apply to results. However, changing the “Sort By” option causes the parameters to be lost entirely, forcing users to re-enter them. codinghorror asks for input from cpradio, who initially suspects the Ember upgrade and references a prior fix. After testing, cpradio finds the issue is inconsistent — parameters persist after a hard refresh and using the search icon, but vanish after clicking the full-page search button, and remain gone for subsequent searches. codinghorror then tags eviltrout, who identifies the root cause: a recent patch that removes hidden whitespace from search terms inadvertently stripped the parameters. eviltrout provides a fix in commit aaaa93c2.

Since the release of version 1.8 I’ve noticed that the search parameters group:[group name] & @username (I haven’t checked others) that have been typed into the search bar, are removed from the search box itself & the query summary, when I execute a search -

becomes

though the parameter is still applied to the search.

But if I then change the result’s Sort By (blue box above), the parameter is not applied to the search so I have to keep adding it back into the query if I do this or want to try a different search term.

Presumably this is a bug? (Apologies if this has been posted already, I did look).

1 Like

Any thoughts here @cpradio?

Possibly the Ember upgrade?

It seems I have fixed this once before, not sure why it no longer works though
https://github.com/discourse/discourse/commit/70cf36700be50e8a5512fe3042b8c0febc5cb1b0#diff-d8f8a0225b6661e2dd68852bdeb0b9e5

2 Likes

I think I’ve proven it now. I just loaded the following commit:
SECURITY: theme key should be an anon cache breaker · discourse/discourse@ac1f84d · GitHub

Which is immediately before the Ember 2.13 upgrade and the search operators are maintained. I’m about to upgrade to Upgrade Ember to 2.13 · discourse/discourse@8ae4457 · GitHub to verify they disappear, but at the very least, I know for a fact, it just broke recently.

Edited:
Welp, that sounded good in theory, but it seems to not be entirely true, I’m not 100% sure when this broke now. I discovered if you do a hard refresh, and then use the search icon, and click Show More, the parameters transfer fine. Once you click the search button on the full page search… they disappear, and they continue to disappear on all future searches too. This is very bizarre.

1 Like

Probably good for @eviltrout to have a look

This is result of the patch that removed hidden whitespace from search terms. Here’s a fix:

https://github.com/discourse/discourse/commit/aaaa93c216f6a0d712514e80dc5f1dc30ed8ade6

5 Likes