Helper class to search for entities by ID.
More...
|
| __construct (EntityLookup $entityLookup, EntityIdParser $idParser, LabelDescriptionLookup $labelDescriptionLookup, array $entityTypeToRepositoryMapping) |
|
| getRankedSearchResults ( $text, $languageCode, $entityType, $limit, $strictLanguage) |
| Gets exact matches.
|
|
|
| getEntityIdMatchingSearchTerm ( $term, $entityType) |
| Returns EntityIds matching the search term (possibly with some repository prefix).
|
|
| getEntityIdCandidatesForSearchTerm ( $term) |
| Returns a generator for candidates of entity ID serializations from a search term.
|
|
| getMatchingId (EntityId $entityId) |
| Returns a list of entity IDs matching the pattern defined by $entityId: existing entities of type of $entityId, and serialized id equal to $entityId, possibly including prefixes of configured repositories.
|
|
| getDisplayTerms (EntityId $entityId) |
|
Helper class to search for entities by ID.
- Copyright
- GPL-2.0-or-later
◆ __construct()
Wikibase\Repo\Api\EntityIdSearchHelper::__construct |
( |
EntityLookup |
$entityLookup, |
|
|
EntityIdParser |
$idParser, |
|
|
LabelDescriptionLookup |
$labelDescriptionLookup, |
|
|
array |
$entityTypeToRepositoryMapping |
|
) |
| |
- Parameters
-
EntityLookup | $entityLookup | |
EntityIdParser | $idParser | |
LabelDescriptionLookup | $labelDescriptionLookup | |
string[][] | $entityTypeToRepositoryMapping | Associative array (string => string[][]) mapping entity types to a list of repository names which provide entities of the given type. |
◆ getDisplayTerms()
Wikibase\Repo\Api\EntityIdSearchHelper::getDisplayTerms |
( |
EntityId |
$entityId | ) |
|
|
private |
- Parameters
-
- Returns
- Term[] array with keys 'label' and 'description'
◆ getEntityIdCandidatesForSearchTerm()
Wikibase\Repo\Api\EntityIdSearchHelper::getEntityIdCandidatesForSearchTerm |
( |
|
$term | ) |
|
|
private |
Returns a generator for candidates of entity ID serializations from a search term.
Callers should attempt to parse each candidate in turn and use the first one that does not result in an EntityIdParsingException
.
- Parameters
-
- Returns
- \Generator
◆ getEntityIdMatchingSearchTerm()
Wikibase\Repo\Api\EntityIdSearchHelper::getEntityIdMatchingSearchTerm |
( |
|
$term, |
|
|
|
$entityType |
|
) |
| |
|
private |
Returns EntityIds matching the search term (possibly with some repository prefix).
If search term is a serialized entity id of the requested type, and multiple repositories provide entities of the type, prefixes of each of repositories are added to the search term and those repositories are searched for the result entity ID. If such concatenated entity IDs are found in several respective repositories, this returns all relevant matches.
- Parameters
-
string | $term | |
string | $entityType | |
- Returns
- EntityId|null
◆ getMatchingId()
Wikibase\Repo\Api\EntityIdSearchHelper::getMatchingId |
( |
EntityId |
$entityId | ) |
|
|
private |
Returns a list of entity IDs matching the pattern defined by $entityId: existing entities of type of $entityId, and serialized id equal to $entityId, possibly including prefixes of configured repositories.
- Parameters
-
- Returns
- EntityId|null
◆ getRankedSearchResults()
Wikibase\Repo\Api\EntityIdSearchHelper::getRankedSearchResults |
( |
|
$text, |
|
|
|
$languageCode, |
|
|
|
$entityType, |
|
|
|
$limit, |
|
|
|
$strictLanguage |
|
) |
| |
Gets exact matches.
If there are not enough exact matches, it gets prefixed matches.
- Parameters
-
string | $text | |
string | $languageCode | |
string | $entityType | |
int | $limit | |
bool | $strictLanguage | |
- Returns
- TermSearchResult[] Key: string Serialized EntityId
Implements Wikibase\Repo\Api\EntitySearchHelper.
◆ $entityLookup
Wikibase\Repo\Api\EntityIdSearchHelper::$entityLookup |
|
private |
◆ $entityTypeToRepositoryMapping
Wikibase\Repo\Api\EntityIdSearchHelper::$entityTypeToRepositoryMapping |
|
private |
◆ $idParser
Wikibase\Repo\Api\EntityIdSearchHelper::$idParser |
|
private |
◆ $labelDescriptionLookup
Wikibase\Repo\Api\EntityIdSearchHelper::$labelDescriptionLookup |
|
private |
The documentation for this class was generated from the following file: