Add support for OR operator in search

It doesn’t seem to be possible to search for multiple terms with an OR operator.

This would be handy to find topics and posts referring to things that users don’t use consistent nomenclature for.


i believe the syntax is a comma for “or” and a plus sign for “and”.

as in “term1,term2” and “term1+term2”

but it isn’t currently possible to combine them, as in “(term1+term2), term3”.

note: moved this from feature category to support

In a quick test, the comma doesn’t appear to work. I tried to look for user documentation for search syntax, but I didn’t find any — does such documentation exist?

hmm not sure about those search counters but i got the comma to work here on meta with appropriate results. also worked on my forum… :thinking:

Hi @paulo :slight_smile:

I’m afraid operators are not supported at this time in the search.

1 Like

this is interesting. how am i getting different results for my different searches? now i’m so confused by what my search results show. :thinking:

Can you provide an example?

i purposely picked two specific terms with less than 50 results each:

search meta for “drift” = 48 results
search meta for “chatbot” = 36 results and it seems only one has “drift” in the post.

search meta for “drift+chatbot” or “drift,chatbot” = one results, the one with both terms

i’ve repro’d on my site too. i’ve even specified other filters like before/after date, although i get weird results when i use the date filters sometimes.

i got the operators to work with the search topic title only filter on my site.

eg: tailgate + party in:title = 15 results that matched

“term + term”, “term, term” or “term term” are equivalent. By default, Discourse search for all the terms, which can be considered as an AND, but there are no advanced operator, like OR, NOT and so on, as far as I know[1]

  1. I sometimes think I know more than I do :stuck_out_tongue: ↩︎

1 Like

i wonder if it’s ignoring the symbols? :thinking:

your post makes sense when think about this - we can do multiple terms with no operators. i will mess around with it on my site later with some specific terms. hmmm. i use search a lot so…

ok, so @Canapin is correct of course[1]. i have tested this with a number of specific post and title searches and yes, it will search multiple terms in any order separated by a space and the space is like an AND operator. it seems to treat other characters as if they were spaces. also if one uses quotations around a phrase it searches for the whole string.

  1. they know way more than i do :innocent: ↩︎