Handler to format entities in the search results.
More...
|
| static | onShowSearchHit (SpecialSearch $searchPage, SearchResult $result, array $terms, &$link, &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related, &$html) |
| | Format the output when the search result contains entities.
|
| |
| static | addLanguageAttrs (array &$attr, $displayLanguage, array $text) |
| | Add attributes appropriate for language of this text.
|
| |
| static | addDescription (&$html, array $description, SpecialSearch $searchPage) |
| | Add HTML description to search result.
|
| |
| static | onShowSearchHitTitle (Title $title, &$titleSnippet, SearchResult $result, $terms, SpecialSearch $specialSearch, array &$query, array &$attributes) |
| | Remove span tag placed around title search hit for entity titles to highlight matches in bold.
|
| |
| static | withLanguage ( $text, $displayLanguage) |
| | If text's language is not the same as display language, add marker with language name to the string.
|
| |
|
| | showPlainSearchHit (SpecialSearch $searchPage, SearchResult $result, array $terms, &$link, &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related, &$html) |
| | Show result hit display.
|
| |
| | isTitleEntity (Title $title) |
| | Check whether the title represents entity.
|
| |
| | getEntity (Title $title) |
| | Retrieve entity by title.
|
| |
| | showPlainSearchTitle (Title $title, &$titleSnippet) |
| | Handle search result title.
|
| |
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 |
( |
& |
$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, |
|
|
|
$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 |
Retrieve entity by title.
- Parameters
-
- Returns
- EntityDocument|null
◆ isTitleEntity()
| Wikibase\Repo\Hooks\ShowSearchHitHandler::isTitleEntity |
( |
Title |
$title | ) |
|
|
private |
Check whether the title represents entity.
- Parameters
-
- Returns
- bool
◆ newFromGlobalState()
| static Wikibase\Repo\Hooks\ShowSearchHitHandler::newFromGlobalState |
( |
IContextSource |
$context | ) |
|
|
staticprivate |
◆ onShowSearchHit()
| static Wikibase\Repo\Hooks\ShowSearchHitHandler::onShowSearchHit |
( |
SpecialSearch |
$searchPage, |
|
|
SearchResult |
$result, |
|
|
array |
$terms, |
|
|
& |
$link, |
|
|
& |
$redirect, |
|
|
& |
$section, |
|
|
& |
$extract, |
|
|
& |
$score, |
|
|
& |
$size, |
|
|
& |
$date, |
|
|
& |
$related, |
|
|
& |
$html |
|
) |
| |
|
static |
◆ onShowSearchHitTitle()
| static Wikibase\Repo\Hooks\ShowSearchHitHandler::onShowSearchHitTitle |
( |
Title |
$title, |
|
|
& |
$titleSnippet, |
|
|
SearchResult |
$result, |
|
|
|
$terms, |
|
|
SpecialSearch |
$specialSearch, |
|
|
array & |
$query, |
|
|
array & |
$attributes |
|
) |
| |
|
static |
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 | &$titleSnippet | |
| SearchResult | $result | |
| string | $terms | |
| SpecialSearch | $specialSearch | |
| string[] | &$query | |
| string[] | $attributes | |
◆ showPlainSearchHit()
| Wikibase\Repo\Hooks\ShowSearchHitHandler::showPlainSearchHit |
( |
SpecialSearch |
$searchPage, |
|
|
SearchResult |
$result, |
|
|
array |
$terms, |
|
|
& |
$link, |
|
|
& |
$redirect, |
|
|
& |
$section, |
|
|
& |
$extract, |
|
|
& |
$score, |
|
|
& |
$size, |
|
|
& |
$date, |
|
|
& |
$related, |
|
|
& |
$html |
|
) |
| |
|
private |
◆ showPlainSearchTitle()
| Wikibase\Repo\Hooks\ShowSearchHitHandler::showPlainSearchTitle |
( |
Title |
$title, |
|
|
& |
$titleSnippet |
|
) |
| |
|
private |
Handle search result title.
- Parameters
-
| Title | $title | |
| string | &$titleSnippet | |
◆ 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 |
◆ $languageFallbackChain
| Wikibase\Repo\Hooks\ShowSearchHitHandler::$languageFallbackChain |
|
private |
The documentation for this class was generated from the following file: