Page MenuHomePhabricator

Fix API to work with categorylinks changes
Closed, ResolvedPublic

Description

Author: ayg

Description:
Important points:

  1. The index is now on (cl_to, cl_type, cl_sortkey, cl_from) instead of (cl_to, cl_sortkey, cl_from), where cl_type is enum('page', 'subcat', 'file'). WHERE cl_to='Foo' ORDER BY cl_sortkey is thus now a filesort.
  1. cl_sortkey is now not human-readable, in principle. Currently it sort of is, but it can have a null in it. In the future, it will be totally binary, probably.

Version: 1.17.x
Severity: enhancement

Details

Reference
bz24650

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:00 PM
bzimport added a project: MediaWiki-API.
bzimport set Reference to bz24650.
bzimport created this task.Aug 3 2010, 9:18 PM

ApiQueryCategoryMembers.php:

		$this->addWhereFld( 'cl_to', $categoryTitle->getDBkey() );

<snip>

		} else {
			$this->addWhereRange( 'cl_sortkey', ( $params['dir'] == 'asc' ? 'newer' : 'older' ), $params['startsortkey'], $params['endsortkey'] );
			$this->addWhereRange( 'cl_from', ( $params['dir'] == 'asc' ? 'newer' : 'older' ), null, null );
		}

So we're missing the index as we're not sorting on cl_type

We're using cl_sortkey as a continue. That probably needs changing.

ApiQueryCategories:

Output of sortkey is probably pointless now...?

(In reply to comment #1)

So we're missing the index as we're not sorting on cl_type

Besides sorting we should also actually be doing stuff with cl_type (outputting, filtering).

We're using cl_sortkey as a continue. That probably needs changing.

Yes, needs to be some compound key that forms a unique index.

ApiQueryCategories:
Output of sortkey is probably pointless now...?

Let's keep it around for back compat. It's also not totally useless (useful for e.g. debugging collations and the like).

Output of sortkey is probably pointless now...?

Let's keep it around for back compat. It's also not totally useless (useful for
e.g. debugging collations and the like).

How about anywhere a sortkey is displayed in the api, we now have two fields, sortkey would be the human readable sortkey based cl_sortkey_prefix (on the assumption that most people using the api for sortkeys currently use it to display to user, not to sort things), and then another field, rawsortkey that has the binary sortkey in it.

Does that sound like the right course of action?

Reedy added a comment.Jan 14 2011, 9:34 PM

(In reply to comment #2)

(In reply to comment #1)

So we're missing the index as we're not sorting on cl_type

Besides sorting we should also actually be doing stuff with cl_type
(outputting, filtering).

r80324 allows cl_type to be shown and allows filtering on cl_type

We're using cl_sortkey as a continue. That probably needs changing.

Yes, needs to be some compound key that forms a unique index.

That's the next job... See what I can come up with.

ApiQueryCategories:
Output of sortkey is probably pointless now...?

Let's keep it around for back compat. It's also not totally useless (useful for
e.g. debugging collations and the like).

(In reply to comment #3)

Output of sortkey is probably pointless now...?

Let's keep it around for back compat. It's also not totally useless (useful for
e.g. debugging collations and the like).

How about anywhere a sortkey is displayed in the api, we now have two fields,
sortkey would be the human readable sortkey based cl_sortkey_prefix (on the
assumption that most people using the api for sortkeys currently use it to
display to user, not to sort things), and then another field, rawsortkey that
has the binary sortkey in it.
Does that sound like the right course of action?

That seems sane. Hopefully people aren't doing anything, but we have no idea.

Keeping the names more like the cols is probably a better idea

Roan, what do you think about what Bawolff suggested?

Right, all done by r80362, RELEASE-NOTES in r80363

Going to log a related bug too...