Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper Class Reference

Helper class to search for entities via an api from another wikibase instance. More...

+ Inheritance diagram for Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper:
+ Collaboration diagram for Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper:

Public Member Functions

 __construct (GenericActionApiClient $api, array $enabledDataTypes)
 
 getRankedSearchResults ( $text, $languageCode, $entityType, $limit, $strictLanguage)
 Get entities matching the search term.
 

Public Attributes

const API_SEARCH_MULTIPLIER = 2
 

Private Member Functions

 filterRequest (array $jsonResult, int $limit)
 
 makeRequest (string $text, string $languageCode, string $entityType, int $limit, bool $strictLanguage)
 
 getMatchedTerm (array $match)
 

Private Attributes

 $api
 
 $typesEnabled = []
 

Detailed Description

Helper class to search for entities via an api from another wikibase instance.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper::__construct ( GenericActionApiClient  $api,
array  $enabledDataTypes 
)
Parameters
GenericActionApiClient$api
string[]$enabledDataTypes

Member Function Documentation

◆ filterRequest()

Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper::filterRequest ( array  $jsonResult,
int  $limit 
)
private
Parameters
array$jsonResult
int$limit
Returns
array
Exceptions
FederatedPropertiesException
See also
https://phabricator.wikimedia.org/T252012

◆ getMatchedTerm()

Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper::getMatchedTerm ( array  $match)
private

◆ getRankedSearchResults()

Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper::getRankedSearchResults (   $text,
  $languageCode,
  $entityType,
  $limit,
  $strictLanguage 
)

Get entities matching the search term.

Parameters
string$text
string$languageCode
string$entityType
int$limit
bool$strictLanguage
Returns
TermSearchResult[] Key: string Serialized EntityId
Exceptions
InvalidArgumentException

Implements Wikibase\Repo\Api\EntitySearchHelper.

◆ makeRequest()

Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper::makeRequest ( string  $text,
string  $languageCode,
string  $entityType,
int  $limit,
bool  $strictLanguage 
)
private
Parameters
string$text
string$languageCode
string$entityType
int$limit
bool$strictLanguage
Returns
mixed
Exceptions
ApiRequestException
See also
https://www.wikidata.org/w/api.php?action=help&modules=wbsearchentities

Member Data Documentation

◆ $api

Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper::$api
private

◆ $typesEnabled

Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper::$typesEnabled = []
private

◆ API_SEARCH_MULTIPLIER

const Wikibase\Repo\FederatedProperties\ApiEntitySearchHelper::API_SEARCH_MULTIPLIER = 2

The documentation for this class was generated from the following file: