&$titleSnippet: Label for the link representing the search result. Typically the
article title.
$result: The SearchResult object
-$terms: String of the search terms entered
+$terms: array of search terms extracted by SearchDatabase search engines
+ (may not be populated by other search engines).
$specialSearch: The SpecialSearch object
&$query: Array of query string parameters for the link representing the search
result.
/** @var int */
protected $offset = 0;
- /** @var array|string */
+ /** @var string[] */
protected $searchTerms = [];
/** @var bool */
* Wikitext highlighting when $wgAdvancedSearchHighlighting = true
*
* @param string $text
- * @param array $terms Terms to highlight (not html escaped but
+ * @param string[] $terms Terms to highlight (not html escaped but
* regex escaped via SearchDatabase::regexTerm())
* @param int $contextlines
* @param int $contextchars
* Used when $wgAdvancedSearchHighlighting is false.
*
* @param string $text
- * @param array $terms Escaped for regex by SearchDatabase::regexTerm()
+ * @param string[] $terms Escaped for regex by SearchDatabase::regexTerm()
* @param int $contextlines
* @param int $contextchars
* @return string
}
/**
- * @param array $terms Terms to highlight
+ * @param string[] $terms Terms to highlight
* @return string Highlighted text snippet, null (and not '') if not supported
*/
function getTextSnippet( $terms ) {
* the search terms as parsed by this engine in a text extract.
* STUB
*
- * @return array
+ * @return string[]
*/
function termMatches() {
return [];
class SqlSearchResultSet extends SearchResultSet {
/** @var ResultWrapper Result object from database */
protected $resultSet;
- /** @var string Requested search query */
+ /** @var string[] Requested search query */
protected $terms;
/** @var int|null Total number of hits for $terms */
protected $totalHits;
/**
* @param SearchResult $result The result to render
- * @param string $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
+ * @param string[] $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param int $position The result position, including offset
* @return string HTML
*/
* title with highlighted words).
*
* @param SearchResult $result
- * @param string $terms
+ * @param string[] $terms
* @param int $position
* @return string HTML
*/
/**
* @param SearchResult $result The result to render
- * @param string $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
+ * @param string[] $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param int $position The result position, including offset
* @return string HTML
*/
interface SearchResultWidget {
/**
* @param SearchResult $result The result to render
- * @param string $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
+ * @param string[] $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param int $position The zero indexed result position, including offset
* @return string HTML
*/
/**
* @param SearchResult $result The result to render
- * @param string $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
+ * @param string[] $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param int $position The result position, including offset
* @return string HTML
*/
}
/**
- * @param array $termsArray
- * @return array
+ * @param string[] $termsArray
+ * @return string[]
*/
function convertForSearchResult( $termsArray ) {
# some languages, e.g. Chinese, need to do a conversion
}
/**
- * @param array $termsArray
- * @return array
+ * @param string[] $termsArray
+ * @return string[]
*/
function convertForSearchResult( $termsArray ) {
$terms = implode( '|', $termsArray );