Last modified: 2014-02-03 14:01:41 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 T62706, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 60706 - Option to get API:Query results unsorted
Option to get API:Query results unsorted
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.23.0
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-01 01:01 UTC by Xelgen
Modified: 2014-02-03 14:01 UTC (History)
7 users (show)

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


Attachments

Description Xelgen 2014-02-01 01:01:52 UTC
Currently API:Query automatically sorts pages alphabetically.

So query like this

http://en.wikipedia.org/w/api.php?action=query&prop=revisions&format=json&rvprop=content&export=&titles=Orange|Apple|Banana

Will return pages in following (alphabetical) order: Apple, Banana, Orange

I see a lot of cases when it's handy, but there are also cases, when you don't want API to sort results and would prefer it to return pages in order requested (e.g. Orange, Apple, Banana).

I suggest, some kind of API key be added to query options, requesting NOT to sort results (e.g. nosort).

If you need actual example, when sorting does more harm then good, I'm querying DjVu pages from Wikisource, and I'm requesting pages in following order: Book/99|Book/100|Book101, and response I get is Book/100, Book/101, Book/99.

Sorting can be good, and can be bad, and we need an option to get results in order they were requested.

I believe it shouldn't be hard to implement.
Comment 1 Umherirrender 2014-02-01 14:11:34 UTC
To apply limits and to allow query-continue to work the result of the database is always in sort order. Without a predefined order it is not possible to get the next batch, when needed.

In your example there is no continue, but that is only known after receive the data from the database. In that case it could be possible to sort the result on the server.

In my opinion it should be easier to sort the result on the client or to iterate over the given titles and get the part of the result instead of iterate over the result.
Comment 2 Andre Klapper 2014-02-03 13:50:43 UTC
Thanks for sharing your idea. 
The bug title does not describe a bug but a solution or feature / new functionality. Hence setting priority to enhancement.
Comment 3 Brad Jorsch 2014-02-03 14:01:41 UTC
I'm marking this as WONTFIX for the reasons described in comment 1. Continuation requires that the database queries be sorted.

If clients need the result pages in a particular order, they can easily enough pull the results into a local data structure and sort them there.

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


Navigation
Links