Handler to format entities in the search results.
More...
|
| __construct (EntityContentFactory $entityContentFactory, EntityIdLookup $entityIdLookup, EntityLookup $entityLookup, LanguageFallbackChainFactory $fallbackChainFactory) |
|
| onShowSearchHit ( $searchPage, $result, $terms, &$link, &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related, &$html) |
| Format the output when the search result contains entities. More...
|
|
| onShowSearchHitTitle (&$title, &$titleSnippet, $result, $terms, $specialSearch, &$query, &$attributes) |
| Remove span tag placed around title search hit for entity titles to highlight matches in bold. More...
|
|
|
static | addLanguageAttrs (array &$attr, string $displayLanguage, array $text) |
| Add attributes appropriate for language of this text. More...
|
|
static | addDescription (string &$html, array $description, SpecialSearch $searchPage) |
| Add HTML description to search result. More...
|
|
static | withLanguage ( $text, $displayLanguage) |
| If text's language is not the same as display language, add marker with language name to the string. More...
|
|
Handler to format entities in the search results.
- Copyright
- GPL-2.0-or-later
- Author
- Matěj Suchánek
-
Daniel Kinzler
◆ __construct()
◆ addDescription()
static Wikibase\Repo\Hooks\ShowSearchHitHandler::addDescription |
( |
string & |
$html, |
|
|
array |
$description, |
|
|
SpecialSearch |
$searchPage |
|
) |
| |
|
static |
Add HTML description to search result.
- Parameters
-
string | &$html | The html of the description will be appended here. |
string[] | $description | Description as [language, value] array |
SpecialSearch | $searchPage | |
◆ addLanguageAttrs()
static Wikibase\Repo\Hooks\ShowSearchHitHandler::addLanguageAttrs |
( |
array & |
$attr, |
|
|
string |
$displayLanguage, |
|
|
array |
$text |
|
) |
| |
|
static |
Add attributes appropriate for language of this text.
- Parameters
-
array | &$attr | Link attributes, to be modified if needed |
string | $displayLanguage | |
array | $text | Text description array, with language in ['language'] |
◆ getEntity()
Wikibase\Repo\Hooks\ShowSearchHitHandler::getEntity |
( |
Title |
$title | ) |
|
|
private |
◆ isTitleEntity()
Wikibase\Repo\Hooks\ShowSearchHitHandler::isTitleEntity |
( |
Title |
$title | ) |
|
|
private |
◆ onShowSearchHit()
Wikibase\Repo\Hooks\ShowSearchHitHandler::onShowSearchHit |
( |
|
$searchPage, |
|
|
|
$result, |
|
|
|
$terms, |
|
|
& |
$link, |
|
|
& |
$redirect, |
|
|
& |
$section, |
|
|
& |
$extract, |
|
|
& |
$score, |
|
|
& |
$size, |
|
|
& |
$date, |
|
|
& |
$related, |
|
|
& |
$html |
|
) |
| |
Format the output when the search result contains entities.
- See also
- https://www.mediawiki.org/wiki/Manual:Hooks/ShowSearchHit
-
showEntityResultHit
-
showPlainSearchHit
- Parameters
-
SpecialSearch | $searchPage | |
SearchResult | $result | |
string[] | $terms | |
string | &$link | |
string | &$redirect | |
string | &$section | |
string | &$extract | |
string | &$score | |
string | &$size | |
string | &$date | |
string | &$related | |
string | &$html | |
- Returns
- void
◆ onShowSearchHitTitle()
Wikibase\Repo\Hooks\ShowSearchHitHandler::onShowSearchHitTitle |
( |
& |
$title, |
|
|
& |
$titleSnippet, |
|
|
|
$result, |
|
|
|
$terms, |
|
|
|
$specialSearch, |
|
|
& |
$query, |
|
|
& |
$attributes |
|
) |
| |
Remove span tag placed around title search hit for entity titles to highlight matches in bold.
- Todo:
- Add highlighting when Q##-id matches and not label text.
- Parameters
-
Title | &$title | |
string | HtmlArmor | null | &$titleSnippet | |
SearchResult | $result | |
array | $terms | |
SpecialSearch | $specialSearch | |
string[] | &$query | |
string[] | &$attributes | |
- Returns
- void
◆ withLanguage()
static Wikibase\Repo\Hooks\ShowSearchHitHandler::withLanguage |
( |
|
$text, |
|
|
|
$displayLanguage |
|
) |
| |
|
static |
If text's language is not the same as display language, add marker with language name to the string.
- Parameters
-
string[] | $text | ['language' => LANG, 'value' => TEXT] |
string | $displayLanguage | |
- Returns
- array ['language' => LANG, 'value' => TEXT]
◆ $entityContentFactory
Wikibase\Repo\Hooks\ShowSearchHitHandler::$entityContentFactory |
|
private |
◆ $entityIdLookup
Wikibase\Repo\Hooks\ShowSearchHitHandler::$entityIdLookup |
|
private |
◆ $entityLookup
Wikibase\Repo\Hooks\ShowSearchHitHandler::$entityLookup |
|
private |
◆ $fallbackChainFactory
Wikibase\Repo\Hooks\ShowSearchHitHandler::$fallbackChainFactory |
|
private |
The documentation for this class was generated from the following file: