Page MenuHomePhabricator

api generator query does not preserve search result order
Closed, ResolvedPublic

Description

Author: wikibugs

Description:
If i search Wikipedia for something like "cain abel" the results are ordered:
https://en.wikipedia.org/w/index.php?title=Special%3ASearch&profile=default&search=cain+abel&fulltext=Search

The top-page is what i'd expect.

This returns articles in the same order via the API:
http://en.wikipedia.org/w/api.php?format=json&action=query&redirects&list=search&srlimit=10&srsearch=cain%20abel :
"query": {

"searchinfo": {
    "totalhits": 705
},
"search": [
    {
        "ns": 0,
        "title": "Cain and Abel",
        "snippet": "<span class='searchmatch'>Cain</span> and <span class='searchmatch'>Abel</span>. (הֶבֶל ,קַיִן. Qayin, Hevel) were, according to the Book of Genesis , - two sons of Adam and Eve . <span class='searchmatch'>Cain</span> is described as a crop <b>...</b> ",
        "size": 36249,
        "wordcount": 5321,
        "timestamp": "2014-07-21T17:49:45Z"
    },
    {
        "ns": 0,
        "title": "Cains & Abels",
        "snippet": "<span class='searchmatch'>Cains</span> & <span class='searchmatch'>Abels</span> is a musical group originally from Grand Rapids , Michigan currently based in Chicago , Illinois . The band consists of <b>...</b> ",
        "size": 2956,
        "wordcount": 353,
        "timestamp": "2013-03-20T09:54:19Z"
    },
    ...,
    {
        "ns": 0,
        "title": "Abel Cain",
        "snippet": "<span class='searchmatch'>Abel</span> <span class='searchmatch'>Cain</span> (formerly Sons of El Topo) is a stalled film project written and directed by Alejandro Jodorowsky . It is being produced and <b>...</b> ",
        "size": 5560,
        "wordcount": 791,
        "timestamp": "2014-07-05T14:21:17Z"
    },

...

If i now want further info about each of the pages i can use a generator like this:
http://en.wikipedia.org/w/api.php?format=json&action=query&redirects=&indexpageids=&prop=info|categories&clcategories=Category:Disambiguation%20pages&generator=search&gsrlimit=10&gsrsearch=cain%20abel :
"query": {

"searchinfo": {
    "totalhits": 705
},
"pageids": [
    "30350202",
    "192648",
    "31398296",
    "430215",
    "24807625",
    "25433348",
    "4215000",
    "29923085",
    "30158033",
    "23087052"
],
"pages": {
    "30350202": {
        "pageid": 30350202,
        "ns": 0,
        "title": "Abel Cain",
        "contentmodel": "wikitext",
        "pagelanguage": "en",
        "touched": "2014-07-05T14:21:18Z",
        "lastrevid": 615697869,
        "counter": "",
        "length": 5560
    },
    "192648": {
        "pageid": 192648,
        "ns": 0,
        "title": "Cain and Abel",
        "contentmodel": "wikitext",
        "pagelanguage": "en",
        "touched": "2014-07-24T10:18:49Z",
        "lastrevid": 617875627,
        "counter": "",
        "length": 36249
    },

...

The generator seems to re-order the pages by title. The first result now is not what i'd expect anymore :(.

If you reduce the gsrlimit to 1 you can observe that the underlying search seems to have passed the correct page first.

Is there any chance the pageids could be ordered as returned by the providing function?


Version: unspecified
Severity: normal

Details

Reference
bz68515

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:30 AM
bzimport set Reference to bz68515.
bzimport added a subscriber: Unknown Object (MLST).
  • This bug has been marked as a duplicate of bug 14859 ***

wikibugs wrote:

sorry for dup, but it's rather on 67131 than 14859...

*** This bug has been marked as a duplicate of bug 67131 ***