Thanks - is there any way I can perform a search and get the page URLs in a single query?

On 26 July 2012 10:36, Bryan Tong Minh <bryan.tongminh@gmail.com> wrote:
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="(&lt;span
> class=&#039;searchmatch&#039;&gt;Persephone&lt;/span&gt; ) is a musical work
> (mélodrame) for speaker, solo singers, chorus, dancers and orchestra with
> music by &lt;span class=&#039;searchmatch&#039;&gt;Igor&lt;/span&gt;
> &lt;span class=&#039;searchmatch&#039;&gt;Stravinsky&lt;/span&gt;  and a
> &lt;b&gt;...&lt;/b&gt; " 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