search_entities#

wikibaseintegrator.wbi_helpers.search_entities(search_string, language=None, strict_language=False, search_type='item', max_results=50, dict_result=False, allow_anonymous=True, **kwargs)[source]#

Performs a search for entities in the Wikibase instance using labels and aliases. You can have more information on the parameters in the MediaWiki API help (https://www.wikidata.org/w/api.php?action=help&modules=wbsearchentities)

Parameters:
  • search_string (str) – A string which should be searched for in the Wikibase instance (labels and aliases)

  • language (str | None, default: None) – The language in which to perform the search. This only affects how entities are selected. Default is ‘en’ from wbi_config. You can see the list of languages for Wikidata at https://www.wikidata.org/wiki/Help:Wikimedia_language_codes/lists/all (Use the WMF code)

  • strict_language (bool, default: False) – Whether to disable language fallback. Default is ‘False’.

  • search_type (str, default: 'item') – Search for this type of entity. One of the following values: form, item, lexeme, property, sense, mediainfo

  • max_results (int, default: 50) – The maximum number of search results returned. Default is 50. A single API call is limited to 50 results; higher values trigger additional paginated calls and the returned list is truncated to this length.

  • dict_result (bool, default: False) – Return the results as a detailed dictionary instead of a list of IDs.

  • allow_anonymous (bool, default: True) – Allow anonymous interaction with the MediaWiki API. ‘True’ by default.

Return type:

list[dict[str, Any]]