Last modified: 2008-10-18 01:22:34 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 T17995, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 15995 - categorymembers (list module) new parameter request
categorymembers (list module) new parameter request
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-15 19:28 UTC by Bruno
Modified: 2008-10-18 01:22 UTC (History)
3 users (show)

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


Attachments

Description Bruno 2008-10-15 19:28:23 UTC
Two questions from a conversation over at Wikipedia willage pump (technical): 

1) is it possible to add parameters to the categorymembers query - say, 'cmstartsorted' and 'cmendsorted' - that will give a list of pages between page X and page Y according to the category's sort order?  currently, we can only get ranges of pages according to timestamps.

2) could those parameters also take ascending/descending arguments?  the original question was whether there was a way to find immediate neighbors in the category to a category member (which is currently possible for later members by tricking the query-continue element, but not for previous members).

so, something like: 

api?action=query&list=categorymembers&cmstartsorted=pagename1&cmendsorted=pagename2

would give all the category members between pagename1 and pagename2, whereas something like

api?action=query&list=categorymembers&cmstartsorted=pagename1&cmdir=desc

would give a list of category members starting at pagename1 and descending according to sort order

while we're at it, it's not at all clear what timestamps above refer to: the date the pages were last edited? the date the pages were added to the category?  if you could clarify that, I'll add it to the API documentation.
Comment 1 Roan Kattouw 2008-10-15 20:13:49 UTC
(In reply to comment #0)
> Two questions from a conversation over at Wikipedia willage pump (technical): 
> 
> 1) is it possible to add parameters to the categorymembers query - say,
> 'cmstartsorted' and 'cmendsorted' - that will give a list of pages between page
> X and page Y according to the category's sort order?  currently, we can only
> get ranges of pages according to timestamps.
> 
> 2) could those parameters also take ascending/descending arguments?  the
> original question was whether there was a way to find immediate neighbors in
> the category to a category member (which is currently possible for later
> members by tricking the query-continue element, but not for previous members).
> 
> so, something like: 
> 
> api?action=query&list=categorymembers&cmstartsorted=pagename1&cmendsorted=pagename2
> 
> would give all the category members between pagename1 and pagename2, whereas
> something like
> 
> api?action=query&list=categorymembers&cmstartsorted=pagename1&cmdir=desc
> 
> would give a list of category members starting at pagename1 and descending
> according to sort order
That's definitely possible, and already being done behind scenes to some extent by cmcontinue.


> while we're at it, it's not at all clear what timestamps above refer to: the
> date the pages were last edited? the date the pages were added to the category?
>  if you could clarify that, I'll add it to the API documentation.
> 
I have absolutely no idea.
Comment 2 Bryan Tong Minh 2008-10-15 20:18:29 UTC
(In reply to comment #1)

> > while we're at it, it's not at all clear what timestamps above refer to: the
> > date the pages were last edited? the date the pages were added to the category?
> >  if you could clarify that, I'll add it to the API documentation.
> > 
> I have absolutely no idea.
> 

The time LinksUpdate triggered a change in category. This is usually when the category is added to the page, but I don't know whether the job queue and purging while being in the job queue has influence on this.
Comment 3 Roan Kattouw 2008-10-15 20:20:18 UTC
(In reply to comment #2)
> (In reply to comment #1)
> 
> > > while we're at it, it's not at all clear what timestamps above refer to: the
> > > date the pages were last edited? the date the pages were added to the category?
> > >  if you could clarify that, I'll add it to the API documentation.
> > > 
> > I have absolutely no idea.
> > 
> 
> The time LinksUpdate triggered a change in category. This is usually when the
> category is added to the page, but I don't know whether the job queue and
> purging while being in the job queue has influence on this.
> 

Is this timestamp updated every time LinksUpdate purges a page, or only under certain conditions?
Comment 4 Bryan Tong Minh 2008-10-15 20:24:57 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > 
> > > > while we're at it, it's not at all clear what timestamps above refer to: the
> > > > date the pages were last edited? the date the pages were added to the category?
> > > >  if you could clarify that, I'll add it to the API documentation.
> > > > 
> > > I have absolutely no idea.
> > > 
> > 
> > The time LinksUpdate triggered a change in category. This is usually when the
> > category is added to the page, but I don't know whether the job queue and
> > purging while being in the job queue has influence on this.
> > 
> 
> Is this timestamp updated every time LinksUpdate purges a page, or only under
> certain conditions?
> 

Only when the category changes. But that's all from head, I should look it up to give a definite answer.
Comment 5 Roan Kattouw 2008-10-17 14:27:14 UTC
Fixed in r42169.
Comment 6 Bruno 2008-10-17 22:18:03 UTC
when will this be implemented?  I just tried the following as a test:

api.php?format=jsonfm&action=query&list=categorymembers&cmtitle=Category:States%20of%20the%20United%20States&cmsort=sortkey&cmstartsortkey=Alabama

and it seemed not to have any effect.  It didn't throw an error, mind you, so it recognizes the parameter, but the output I got (see below) definitely didn't start with Alabama.

{
	"query-continue": {
		"categorymembers": {
			"cmcontinue": "Arizona|"
		}
	},
	"query": {
		"categorymembers": [
			{
				"pageid": 3382464,
				"ns": 14,
				"title": "Category:Fictional U.S. states"
			},
			{
				"pageid": 5760442,
				"ns": 14,
				"title": "Category:United States interstate compacts"
			},
			{
				"pageid": 18618239,
				"ns": 0,
				"title": "U.S. state"
			},
			{
				"pageid": 5805863,
				"ns": 14,
				"title": "Category:States of the United States related lists"
			},
			{
				"pageid": 15012635,
				"ns": 14,
				"title": "Category:Proposed states and territories of the United States"
			},
			{
				"pageid": 1055166,
				"ns": 14,
				"title": "Category:Categories by state of the United States"
			},
			{
				"pageid": 303,
				"ns": 0,
				"title": "Alabama"
			},
			{
				"pageid": 705602,
				"ns": 14,
				"title": "Category:Alabama"
			},
			{
				"pageid": 624,
				"ns": 0,
				"title": "Alaska"
			},
			{
				"pageid": 702716,
				"ns": 14,
				"title": "Category:Alaska"
			}
		]
	}
}
Comment 7 Bryan Tong Minh 2008-10-17 22:20:15 UTC
When somebody updates the Wikimedia servers. Which maybe within hours, or after the weekend, or later.
Comment 8 Roan Kattouw 2008-10-17 22:21:44 UTC
(In reply to comment #6)
> when will this be implemented?  I just tried the following as a test:
> 
> api.php?format=jsonfm&action=query&list=categorymembers&cmtitle=Category:States%20of%20the%20United%20States&cmsort=sortkey&cmstartsortkey=Alabama
> 
> and it seemed not to have any effect.
That's because I only fixed it today, and the fix hasn't gone live at Wikipedia yet. It won't go live over the weekend either, probably some time next week.

>  It didn't throw an error, mind you, so
> it recognizes the parameter, but the output I got (see below) definitely didn't
> start with Alabama.
Bogus parameters don't cause errors. Bogus values for parameters that only accept certain values do.
Comment 9 Bruno 2008-10-18 01:22:34 UTC
hey guys, this is the modern world:  we expect IMMEDIATE gratification in all things.  at least, that's what I keep telling my girlfriend...

thanks for the clarifications.  :-)

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


Navigation
Links