Page MenuHomePhabricator

Querying for categories does not work on category pages
Closed, DeclinedPublic

Description

Author: mail

Description:
While a query like

{{#ask: [[{{PAGENAME}}]] | ?Category }}

works flawlessly on a page (and returns the categories a page is in), it returns nothing on category pages (where it should list "parent" categories).


Version: unspecified
Severity: normal

Details

Reference
bz25816

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:13 PM
bzimport set Reference to bz25816.

bugzilla wrote:

I can't directly see if this is a bug or not. Some notes:

First, on page Category:Foo, {{PAGENAME}} returns "Foo". Thus, the query becomes
{{#ask: [[Foo]] | ?Category }}
If there is no page Foo, or it is in no category, then the result is empty.

Second, should you specify
{{#ask: [[Category:Foo]] | ?Category }}
then you're essentially selecting all pages in category Foo, and asking in which categories each page is.

However, I've tested with
{{#ask: [[:Category:Foo]] | ?Category }}
and got no results, where I expected one - so I'll leave it to Markus et al. to check things further.

mail wrote:

Hi Jan, thanks for looking into this.

You're right,
{{#ask: [[{{PAGENAME}}]] | ?Category }}
on a category page would not select "the page I (the query) am on", but instead the pages of that category...

But what I actually meant was your third query - which should definitely return the parent categories as result, imo.

Unknown Object (User) added a comment.Aug 6 2014, 2:57 PM

As of SMW 2.0 doing #ask/#show on a "Category" page results in:

  • {{#ask: [[{{FULLPAGENAME}}]] | ?Category }} will return all pages the Category is assigned to
  • {{#show: {{FULLPAGENAME}} |?Subcategory of }} will show all parent categories the category is assigned to