Boolean logic in search

I like to keep up on stuff about Purism, but I am not interested in the Librem 5, or in cell phones. However, this is the single most popular topic, making it very difficult to see anything but. At first, I thought I’d just keep up on all the categories but the phone but realized I’d need to open 10 or so browser tabs.

As a workaround, I tried several common negation options in search: “-phone”, “NOT phone”, “~(phone)”, “!(phone)” but they all searched for “phone”. Is there a way to do boolean operations in search, or regular expressions?


The forum is using the Discourse software so if noone here knows the answer, you could ask in the Discourse forum or seek out the Discourse documentation.

Screenshot at 2023-04-18 07-15-41

I think all that demonstrates is that the GUI can’t do it. Right?

Your choice of “category” is “all” or one specific category, which is not what the OP wants. The OP wants all categories except one specific category.

The syntax to select a category appears to be ‘#’.

And multiple search criteria always seem to be “anded” together (which means there’s no way to select multiple categories with that approach).

So the original question remains … does Discourse support more advanced boolean logic? e.g. explicit “and”, or “or”, or “not”.

My third screenshot illustrates adding multiple categories to one search, which obviates the ability to leave categories out. (I didn’t test it, though.)

Sorry to be picky but I don’t think it does illustrate that. It is showing one category that happens to be a category-and-subcategory and for some reason on your device has an unusual layout. (Window width?)

I actually still have found no way using the GUI to select multiple categories e.g. select Site Feedback and select General security & privacy chat, which the obvious intention that they are “ored” together (when in fact I don’t think it will work anyway because they will be “anded” together).

You can actually just type in multiple categories (or paste them in) to the search command box at the top of the window. It doesn’t “work” though.

1 Like

Seems you’re correct. I just tried it, too.
My partial screen grabs probably look different due to the FF extension that adjusts font size and opacity for me.

Back to the OP, maybe the best option is to just use the browser search engine and Boolean parameters and limit the search to this site. (Hopefully without getting a lot of “Buy Forums Purism now!” “Cheapest General Privacy and Security!” “Get a deal on Infrastructure!” :rofl:)

Indeed that is the reason that I did not suggest that, even though it is offered directly by the forum software (much to my chagrin).

Whether any particular external search engine supports boolean logic is an open question. It is not something that I have spent a lot of time investigating.

But if the OP can find an external search engine that is
a) trustworthy, and
b) supports boolean logic
then that could be an option.

I don’t think it will work very well though.

By using an internal search, you could (implicitly) specify something like category != "xyz" and it will be explicitly implemented. The functionality if it existed would work!

With an external search engine you are just hoping that the right text does and does not appear in the web page (with occasional additional features that may help and occasional additional smarts that may help). So if you exclude anything mentioning “Librem 5” in an attempt to exclude that category then

a) you could miss out on a page in General chat if the page happens to mention Librem 5 i.e. just one post on the page mentions it in passing, and

b) regardless you will get any discussion of Librem 5 that just abbreviates the product name to L5 (which is lots of posts) - so you need to work a bit harder.

How about this? (Is that boolean?)

1 Like

So coming right back to the OP,

a) a quick look through says “no”, and

b) I think the OP really asked the wrong question. While searching would be one way of tackling this, it is really about “subscribing” or “notifications” or “views”.

Could help.

I see that Discourse is putting the category in the HTML title tag, so you could use intitle:xyz

In the examples they show prefixing the search term with “-” in order to negate it i.e. -intitle:“Librem 5” … maybe. :wink:

Yep. I have to use all the time.

1 Like

Just tried “-intitle:5” which gave me just this post (?) so I tried “-intitle:foo” which gave me nothing (?!?)… this seems altogether broken. (And the URL is “” so I assume that means it’s trying to search the whole forum.)

Not sure what you mean by “browser search engine” but I’m assuming things like (ha!) which would only pick up posts once they are crawled—ergo not necessarily current.

I got so used to ad-blocking that I can’t believe people tolerate this kind of WWW experience!

I think you lost the thread there. That syntax is for using some external search engines.

The point is: I’ve said (on a quick look), no, the forum software just can’t do this. So then it was suggested to use an external search engine instead, but that of course raises the question as to what syntax would even get the desired result with an external search engine.

Of course an external search engine shouldn’t be able to pick up Round Table at all, so that would be one negative of going down that road (compared with using the forum’s own search engine).

My browsers are quite “locked down” as far as tracker/ad-blocking, and I turn off “promotional” results in Startpage, but this kind of crap still shows up in the main results from time to time. :rofl: (Not unique to Startpage, of course.)

To accomplish the task of not seeing what you don’t want to see, maybe look into building a Greasemonkey script instead? I’ve not messed with Greasemonkey in a long time, but when I did it was great for hiding things on forums.

1 Like

I’m like @jasonolshefsky. If, And, Or, Else, Equal, None, would be a logical way.
By depending on a search engine or Google to find something specific in the Forum depends on whether or not the Admin makes areas available or not, and like @jasonolshefsky pointed out, timing is against us.

Correct me if I am wrong, but it doesn’t appear that Puri is using the Discourse Algolia Search plugin that integrates Algolia with Discourse search.

Maybe Google has the copyright for logic? :nerd_face:

I believe we’d get better search results if we had access to operands. It’s the logical way :innocent: