Search for topics that "are not pinned" returns unexpected results

Repro Steps

  1. Navigate to https://meta.discourse.org
  2. Click Search button
  3. Click “options” link
  4. In the “Advanced Search” sidebar, under “Only return topics/posts…” select “are not pinned”
  5. Click the “:mag: Submit” button

Expected: See the list of topics that have never been pinned
Actual: See the list of topics that have been pinned, but are no longer pinned

Details

Seeing the search keyword of in:unpinned, the actual result makes sense. But I don’t believe that it matches with the “human text” version of “are not pinned”. I would suggest the human text of “are unpinned”.

Additionally, I would like to have the ability to search for topics that are not pinned or unpinned (what I was originally attempting to search within), so judging from:

https://github.com/discourse/discourse/commit/77242e4680d310d0c152396824713ca2f8eb275a

I would assume it would be something like:

advanced_filter(/in:not_pinned/) do |posts|
  posts.where("topics.pinned_at IS NULL")
end

But also the need for this specific filter is maybe pretty rare, so lower priority than the bug :grinning:

4 Likes

Sure maybe @sam can assign this next week?

3 Likes

I need help with copy here @codinghorror

https://github.com/discourse/discourse/blob/bb4e8899c41889f7316e512d6ed89a3847fa655b/config/locales/client.en.yml#L1994-L1994

Should be:

“Are pinned topics that are not pinned for me”

“Are pinned topics I have unpinned”

Not sure… maybe we just remove this option from the UI cause it is just confusing to explain to users.

@lee-dohm can you expand on why you need a special search operator. In general 99.99% of the topics are not pinned, removing pinned topics from search results seems like a very big edge case. (and in:pinned already works)

1 Like

Just “pinned” is fine, at the point when you are searching for “pinned but not for me” I don’t think anyone cares about that. Is it a pinned topic yes or no? Whether it is pinned for me personally or not is irrelevant. Why offer a confusing option…

3 Likes

Sure … @vinothkannans can you remove “Are not pinned” from the UI and clean up the translation etc.

1 Like

I was searching for topics with no replies and the majority of the top results were “About the X category” pinned topics. Since the intent was to look for unanswered topics from humans, and I didn’t see an easy way to say “not the system user”, I figured “not pinned” would be the closest to what I wanted. Doing some further testing of similar searches on Meta, it appears that “about” is a stopword and my test search doesn’t show those, or any, pinned topics at the top. So my feature request is most likely not necessary upon further investigation :+1:

3 Likes

The filter is now removed in the below commit

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

6 Likes