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

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T15886, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 13886 - Advanced (boolean) #ask: functions
Advanced (boolean) #ask: functions
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  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: ---


Attachments

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.

Examples:
{{#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.


Navigation
Links