Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Api\SearchEntities Class Reference

API module to search for Wikibase entities. More...

+ Inheritance diagram for Wikibase\Repo\Api\SearchEntities:
+ Collaboration diagram for Wikibase\Repo\Api\SearchEntities:

Public Member Functions

 __construct (ApiMain $mainModule, string $moduleName, EntitySearchHelper $entitySearchHelper, $unused, ContentLanguages $termLanguages, EntitySourceDefinitions $entitySourceDefinitions, EntityTitleTextLookup $entityTitleTextLookup, EntityUrlLookup $entityUrlLookup, EntityArticleIdLookup $entityArticleIdLookup, ApiErrorReporter $errorReporter)
 
 execute ()
 
 executeInternal ()
 

Static Public Member Functions

static factory (ApiMain $mainModule, string $moduleName, EntityArticleIdLookup $entityArticleIdLookup, EntitySourceDefinitions $entitySourceDefinitions, EntityTitleTextLookup $entityTitleTextLookup, EntityUrlLookup $entityUrlLookup, ContentLanguages $termsLanguages)
 

Protected Member Functions

 getAllowedParams ()
 
 getExamplesMessages ()
 

Private Member Functions

 getSearchEntries (array $params)
 Populates the search result returning the number of requested matches plus one additional item for being able to determine if there would be any more results. More...
 
 buildTermSearchMatchEntry (TermSearchResult $match, ?array $props)
 
 getRepositoryOrEntitySourceName (EntityId $entityId)
 

Private Attributes

 $entitySearchHelper
 
 $termsLanguages
 
 $entitySourceDefinitions
 
 $entityTitleTextLookup
 
 $entityUrlLookup
 
 $entityArticleIdLookup
 
 $errorReporter
 

Detailed Description

API module to search for Wikibase entities.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Api\SearchEntities::__construct ( ApiMain  $mainModule,
string  $moduleName,
EntitySearchHelper  $entitySearchHelper,
  $unused,
ContentLanguages  $termLanguages,
EntitySourceDefinitions  $entitySourceDefinitions,
EntityTitleTextLookup  $entityTitleTextLookup,
EntityUrlLookup  $entityUrlLookup,
EntityArticleIdLookup  $entityArticleIdLookup,
ApiErrorReporter  $errorReporter 
)
See also
ApiBase::__construct

Member Function Documentation

◆ buildTermSearchMatchEntry()

Wikibase\Repo\Api\SearchEntities::buildTermSearchMatchEntry ( TermSearchResult  $match,
?array  $props 
)
private
Parameters
TermSearchResult$match
string[] | null$props
Returns
array

The repository key should be deprecated and removed, for now avoid adding it when using federatedProperties to avoid confusion in the new feature and avoid the need to "fix" it.. This is deliberately not tested and thus not injected as for federated properties we "don't care much" and for default Wikibase this is already covered by the SearchEntitiesTest.

Add matched terms to the aliases key in the result to give some context for the matched Term if the matched term is different to the alias. XXX: This appears odd but is used in the UI / Entity suggesters

◆ execute()

Wikibase\Repo\Api\SearchEntities::execute ( )

◆ executeInternal()

Wikibase\Repo\Api\SearchEntities::executeInternal ( )

◆ factory()

static Wikibase\Repo\Api\SearchEntities::factory ( ApiMain  $mainModule,
string  $moduleName,
EntityArticleIdLookup  $entityArticleIdLookup,
EntitySourceDefinitions  $entitySourceDefinitions,
EntityTitleTextLookup  $entityTitleTextLookup,
EntityUrlLookup  $entityUrlLookup,
ContentLanguages  $termsLanguages 
)
static

◆ getAllowedParams()

Wikibase\Repo\Api\SearchEntities::getAllowedParams ( )
protected

◆ getExamplesMessages()

Wikibase\Repo\Api\SearchEntities::getExamplesMessages ( )
protected

◆ getRepositoryOrEntitySourceName()

Wikibase\Repo\Api\SearchEntities::getRepositoryOrEntitySourceName ( EntityId  $entityId)
private

◆ getSearchEntries()

Wikibase\Repo\Api\SearchEntities::getSearchEntries ( array  $params)
private

Populates the search result returning the number of requested matches plus one additional item for being able to determine if there would be any more results.

If there are not enough exact matches, the list of returned entries will be additionally filled with prefixed matches.

Parameters
array$params
Returns
array[]

Member Data Documentation

◆ $entityArticleIdLookup

Wikibase\Repo\Api\SearchEntities::$entityArticleIdLookup
private

◆ $entitySearchHelper

Wikibase\Repo\Api\SearchEntities::$entitySearchHelper
private

◆ $entitySourceDefinitions

Wikibase\Repo\Api\SearchEntities::$entitySourceDefinitions
private

◆ $entityTitleTextLookup

Wikibase\Repo\Api\SearchEntities::$entityTitleTextLookup
private

◆ $entityUrlLookup

Wikibase\Repo\Api\SearchEntities::$entityUrlLookup
private

◆ $errorReporter

Wikibase\Repo\Api\SearchEntities::$errorReporter
private

◆ $termsLanguages

Wikibase\Repo\Api\SearchEntities::$termsLanguages
private

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