Page MenuHomePhabricator

incategory search does not support OR (union) operator
Open, MediumPublic


The Help:Category article says:

An "OR" can be added to join the contents of one category with the contents of another. For example, enter

incategory:"Suspension bridges" OR incategory:"Bridges in New York City"

to return all pages that belong to either (or both) of the categories, as here.

But this search returns no results even though each category by itself returns many results. I've tried this with other categories and it appears that it does an AND (intersection) regardless of the actual operator used.

Event Timeline

Thanks for reporting this!
I do not know if that syntax is supported by CirrusSearch (and will leave that to the developers to answer), but note that the canonical docs at do not cover this case. The docs on English Wikipedia are not maintained by the Search developers.

Yes this is a known limitation of the search syntax. Special keywords cannot be combined with boolean expression.
The current workaround is to put the boolean logic inside the keyword itself by using a |:

incategory:"Suspension bridges|Bridges in New York City"

Should return all articles with at least one of these categories.

debt triaged this task as Medium priority.May 11 2017, 5:09 PM
debt moved this task from needs triage to This Quarter on the Discovery-Search board.
debt subscribed.

We think this is still important for editors, but not sure exactly how hard this will be to do - real-time parsing in PHP.