Page MenuHomePhabricator

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

Description

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

Onlynone created this task.May 5 2017, 2:50 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 5 2017, 2:50 PM

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 https://www.mediawiki.org/w/index.php?title=Help:CirrusSearch&oldid=2453169#Intitle_and_incategory do not cover this case. The docs on English Wikipedia are not maintained by the Search developers.

Restricted Application added projects: Discovery, Discovery-Search. · View Herald TranscriptMay 5 2017, 3:11 PM
dcausse added a subscriber: dcausse.May 5 2017, 3:16 PM

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 added a subscriber: debt.

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