如何进行否定搜索,排除特定术语?

[I am not allowed to put more than two links into the body even though they are local, sorry… I used the search terms below on Search results for '' - Discourse Meta without quotes.]

There supposedly is a operator to negate search terms, according to New search operator "not" but the thread is very unclear what symbol was chosen in the end and there are no final examples. It is the first and pretty much only thing I could find online about it.

The thread talks about “-”, “!” and “~” so I tried them all:

  • “negative search” gives me 43 results with “negative” and/or “search” in them, the terms are highlighted
  • “-negative search” gives me 43 results with “negative” and/or “search” in them, “search” is highlighted
  • “-negative -search” gives me 43 results with “negative” and/or “search” in them, neither is highlighted

So whatever the highlighting means, the “-” symbol is not the operator.
I repeated the same tests with “!” instead, same results.
With “~” I get the same as before for “negative ~search” but zero results for “negative search”.

So how can I exclude specific terms in a search?

Agreed that topic is quite confusing. Can we clarify here Monday @jomaxro?

That topic definitely went through numerous changes. Sorry it is so confusing.

At this time, the negation operator is -, and it only applies to tags. So you can search for topics that do not have a certain tag, but cannot search for topics without a word, or category, etc.

The negation operator is used like so:

green tags:eggs -tags:ham - search for posts containing the word “green”, tagged with eggs, but not tagged with ham.

The following is not a valid search:

-green tags:eggs. While the intent may be to search for posts without the word green tagged with eggs, it will instead search for posts with the word “green” and tagged with eggs.

Oh, that explains my struggles. Thanks for updating the topic of that thread, this will help other’s who look for this functionality.

Would be OK and in any way useful if I added a feature request in feature - Discourse Meta?

Please do! At the time I created the feature request 3 years ago, tag negation was all I needed, so that’s all I requested.

是否计划推出不带指定关键词的搜索功能?我也需要这个功能。我有许多主题会标记为“[DONE] 标题 A”,现在我希望能搜索某个用户的所有主题,同时排除标题中包含“DONE”的主题。