Thanks - is there any way I can perform a search and get the page URLs in a single query?
Query it as a generator:
https://en.wikipedia.org/w/api.php?action=query&generator=search&format=xml&gsrsearch=igor%20stravinsky%20persephone&gsrlimit=1&prop=info
Unfortunately, that discards all meta data provided by the search query module.
Bryan
> _______________________________________________
On Thu, Jul 26, 2012 at 10:23 AM, Jeremy Bradshaw <jbradshaw7@gmail.com> wrote:
> I want to search the mediawiki database and get the page with the closest
> match to my search text. For example, on entering the search string "igor
> stravinsky persephone" I want to get a link to this page:
> http://en.wikipedia.org/wiki/Pers%C3%A9phone_%28Stravinsky%29
>
> The following query
> /w/api.php?action=query&list=search&format=xml&srsearch=igor%20stravinsky%20persephone&srlimit=1
> almost gets what I want but the data returns does not include the pageid:
>
> <p ns="0" title="Perséphone (Stravinsky)" snippet="(<span
> class='searchmatch'>Persephone</span> ) is a musical work
> (mélodrame) for speaker, solo singers, chorus, dancers and orchestra with
> music by <span class='searchmatch'>Igor</span>
> <span class='searchmatch'>Stravinsky</span> and a
> <b>...</b> " size="2500" wordcount="313"
> timestamp="2012-05-13T07:21:00Z" />
>
> Is this the right way to go about it? Is the title returned a unique ID
> which I can use to get more detail of the page?
>
>
> Mediawiki-api mailing list
> Mediawiki-api@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api