Salut à tous !

Je me penche ces temps-ci sur l'intégration d'une recherche wikipedia dans mes 
applications.

Et je voudrais vous faire part de mes trouvailles.
Voici donc un texte résumé qui j'espère sera utile à quelqu'un.

Retrouvez le Texte originel de l'article à l'adresse 
http://www.geonames.org/export/wikipedia-webservice.html

Le principe est qu'on lance une requête via URL à une adresse de wikipedia, et 
on a en retour un fichier xml ou JSON contenant le résultat de la recherche.


Wikipedia Fulltext Search

Type de services web : XML ou JSON 

URL  auxquels envoyer les requêtes: 
api.geonames.org/wikipediaSearch?
api.geonames.org/wikipediaSearchJSON?

Paramètres des requêtes: 
q : expression à rechercher
urlencoded utf8)
title : expression à rechercher dans le titre
lang : code de langue. les langues supportées sont  
de,en,es,fr,it,nl,pl,pt,ru,zh (default = en)
maxRows : nombre maximal d'enregistrement maximal renvoyés  (default = 10)

Résultat : returns the wikipedia entries found for the searchterm as xml 
document 

Exemples de requêtes: 
http://api.geonames.org/wikipediaSearch?q=london&maxRows=10&username=demo

Voici à présent comment seront organisés les informations dans le fichier 
résultat

Tableau: 2 colonnes et 12 lignes
Attribute
Description

lang 
ISO language code of article text  

title 
the article title  

summary 
a short summary of the article text. Around 300 chars. The text is truncated at 
a full stop if one is available near char 300, otherwise at the end of a
word.  

feature 
the wikipedia feature type. A list of types is available 
here  

countryCode 
the ISO country code of the article  

elevation 
the elevation in metres (optional may be null), parsed from the article or 
reverse geocoded.  

population 
the population (optional may be null)  

lat 
latitude  

lng 
longitude  

wikipediaUrl 
URL of the article  

thumbnailImg 
URL of a small thumbnail image (ca 100x75 px)  

rank 
indication of the popularity or relevancy of an article. The rank is an integer 
number from 1 for the least popular articles to 100 for the most popular
articles. It is calculated from the number of links pointing to an article and 
the article length. The articles are more or less evenly distributed over
the 100 ranks. 
Fin du tableau.

Yannick Daniel Youalé
La programmation est une religion. Aimez-la, ou quittez-la.
Mon site web: www.visuweb.net

Répondre à