https://bugzilla.wikimedia.org/show_bug.cgi?id=68515

            Bug ID: 68515
           Summary: api generator query does not preserve search result
                    order
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: API
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: wikib...@joernhees.de
                CC: bjor...@wikimedia.org, bryan.tongm...@gmail.com,
                    roan.katt...@gmail.com, s...@reedyboy.net
       Web browser: ---
   Mobile Platform: ---

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?

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to