Last modified: 2008-08-29 04:49:42 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 13886 - Advanced (boolean) #ask: functions
Advanced (boolean) #ask: functions
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2008-04-30 02:51 UTC by naught101
Modified: 2008-08-29 04:49 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description naught101 2008-04-30 02:51:19 UTC
Currently it appears that it's only possible to do boolean AND #ask commands. It would be very useful to be able to use boolean OR and NOT functions as well.

{{#ask: [[Category:Cities]] [[Location::Europe]]}} is a boolean AND and will return all cities in europe. 

However, this is limited, as it's not possible to find cities in two countries, for example those who speak German:
{{#ask: [[Category:Cities]] AND [[Location::Germany]] OR [[Location::Luxembourg]] OR [[Location::Austria]] OR [[Location::Switzerland]] }}

Or all cities in mainland europe:
{{#ask: [[Category:Cities]] AND NOT [[Location::United Kingdom]] OR [[Location::Ireland]] }}

These are pretty basic examples, but such functionality would make the #ask function much, much more useful in many situations.
Comment 1 Daniel Friesen 2008-04-30 07:59:06 UTC
Actually it is possible. It should be documented, I didn't need to search any source code to know how to do these.

For your two examples these should work:

{{#ask: [[Category:Cities]] [[Location::Germany||Luxembourg||Austria||Switzerland]] }}

and for the other:

{{#ask: [[Category:Cities]] [[Location::!United Kingdom||Ireland]] }}

Basically the two things you didn't catch in the user manual are:

After the :: in ask queries an operator is allowed. This may be >, <, !, and if the wiki has it enabled ~ is also allowed. The > and < are for inclusive greater and less than (They are actually the same as >= and <= rather than the exclusive forms), and ! is for things which are not part of a property. The ~ isn't enabled by default, but it is for LIKE queries, in the form where ? is one character and * is any number of characters.

And the other thing is that inside of a property you can separate multiple allowed values (an OR) with two pipes ||.
Comment 2 naught101 2008-08-29 04:49:42 UTC
great, thanks Dan.

Note You need to log in before you can comment on or make changes to this bug.