Hello all,


Le mar. 4 juin 2019 à 15:46, Marielle Volz <marielle.volz@gmail.com> a écrit :
Yes, the api is at https://www.wikidata.org/w/api.php?action=query&list=search&srsearch=Bush

There's a sandbox where you can play with the various options: 
https://www.wikidata.org/wiki/Special:ApiSandbox#action=query&format=json&list=search&srsearch=Bush


Can anyone point me to the relevant code that supports the search feature? Or explain to me how it is done?


Thanks in advance!


On Tue, Jun 4, 2019 at 2:22 PM Tim Finin <finin@umbc.edu> wrote:
What's the best way to search Wikidata for items whose name or alias matches a string?  The search available via pywikibot seems to only find a match if the search string is a prefix of an item's name or alias, so searching for "Bush" does not return any of the the George Bush items.  I don't want to use a SPARQL query with a regex, since I expect that to be slow.

The search box on the Wikidata pages is closer to what I want.  Is there a good way to call this via an API?

Ideally, I'd like to be able to specify a language and also a set of types, but I can do that once I've identified candidates based on a simple match with a query string.