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

Reply via email to