MediaWiki REL1_41
ISearchResultSet Interface Reference

A set of SearchEngine results. More...

Inherits Countable, and IteratorAggregate.

Inherited by BaseSearchResultSet.

Collaboration diagram for ISearchResultSet:

Public Member Functions

 augmentResult (SearchResult $result)
 Returns extra data for specific result and store it in SearchResult object.
 
 extractResults ()
 Extract all the results in the result set as array.
 
 extractTitles ()
 Extract all the titles in the result set.
 
 getInterwikiResults ( $type=self::SECONDARY_RESULTS)
 Return a result set of hits on other (multiple) wikis associated with this one.
 
 getOffset ()
 
 getQueryAfterRewrite ()
 
 getQueryAfterRewriteSnippet ()
 
 getSuggestionQuery ()
 
 getSuggestionSnippet ()
 
 getTotalHits ()
 Some search modes return a total hit count for the query in the entire article database.
 
 hasInterwikiResults ( $type=self::SECONDARY_RESULTS)
 Check if there are results on other wikis.
 
 hasMoreResults ()
 
 hasRewrittenQuery ()
 Some search modes will run an alternative query that it thinks gives a better result than the provided search.
 
 hasSuggestion ()
 Some search modes return a suggested alternate term if there are no exact hits.
 
 numRows ()
 
 searchContainedSyntax ()
 Did the search contain search syntax? If so, Special:Search won't offer the user a link to a create a page named by the search string because the name would contain the search syntax.
 
 setAugmentedData ( $name, $data)
 Sets augmented data for result set.
 
 shrink ( $limit)
 

Public Attributes

const INLINE_RESULTS = 1
 Identifier for interwiki results that can be displayed even if no existing main wiki results exist.
 
const SECONDARY_RESULTS = 0
 Identifier for interwiki results that are displayed only together with existing main wiki results.
 

Detailed Description

A set of SearchEngine results.

Must not be implemented directly by extensions, extend BaseSearchResultSet instead.

Stability: stable
to type
See also
BaseSearchResultSet

Definition at line 14 of file ISearchResultSet.php.

Member Function Documentation

◆ augmentResult()

ISearchResultSet::augmentResult ( SearchResult $result)

Returns extra data for specific result and store it in SearchResult object.

Parameters
SearchResult$result

Referenced by SqlSearchResultSet\extractResults().

◆ extractResults()

ISearchResultSet::extractResults ( )

Extract all the results in the result set as array.

Returns
SearchResult[]

Implemented in SearchResultSet, and SqlSearchResultSet.

Referenced by PerRowAugmentor\augmentAll().

◆ extractTitles()

ISearchResultSet::extractTitles ( )

Extract all the titles in the result set.

Returns
Title[]

Implemented in SearchResultSet.

◆ getInterwikiResults()

ISearchResultSet::getInterwikiResults ( $type = self::SECONDARY_RESULTS)

Return a result set of hits on other (multiple) wikis associated with this one.

Parameters
int$type
Returns
ISearchResultSet[]

Implemented in SearchResultSet.

◆ getOffset()

ISearchResultSet::getOffset ( )
Returns
int|null The offset the current page starts at. Typically this should be null to allow the UI to decide on its own, but in special cases like interleaved AB tests specifying explicitly is necessary.

◆ getQueryAfterRewrite()

ISearchResultSet::getQueryAfterRewrite ( )
Returns
string|null The search the query was internally rewritten to, or null when the result of the original query was returned.

Implemented in SearchResultSet.

Referenced by MediaWiki\Search\SearchWidgets\DidYouMeanWidget\rewrittenHtml().

◆ getQueryAfterRewriteSnippet()

ISearchResultSet::getQueryAfterRewriteSnippet ( )
Returns
HtmlArmor|string|null Same as self::getQueryAfterRewrite(), but with changes to the string highlighted in HTML and wrapped in HtmlArmor. If highlighting is not available the rewritten query will be returned. When the self::hasRewrittenQuery returns false (i.e. the results have not been rewritten) null will be returned.

Implemented in SearchResultSet.

Referenced by MediaWiki\Search\SearchWidgets\DidYouMeanWidget\rewrittenHtml().

◆ getSuggestionQuery()

ISearchResultSet::getSuggestionQuery ( )
Returns
string|null Suggested query, null if none

Implemented in SearchResultSet.

Referenced by MediaWiki\Search\SearchWidgets\DidYouMeanWidget\suggestionHtml().

◆ getSuggestionSnippet()

ISearchResultSet::getSuggestionSnippet ( )
Returns
HtmlArmor|string Same as self::getSuggestionQuery(), but with changes to the string highlighted in HTML and wrapped in HtmlArmor. If highlighting is not available the suggested query will be returned. When self::hasSuggestion returns false (i.e no suggested query) the empty string will be returned.

Implemented in SearchResultSet.

Referenced by MediaWiki\Search\SearchWidgets\DidYouMeanWidget\suggestionHtml().

◆ getTotalHits()

ISearchResultSet::getTotalHits ( )

Some search modes return a total hit count for the query in the entire article database.

This may include pages in namespaces that would not be matched on the given settings.

Return null if no total hits number is supported.

Returns
int|null

Implemented in FauxSearchResultSet, SearchResultSet, and SqlSearchResultSet.

◆ hasInterwikiResults()

ISearchResultSet::hasInterwikiResults ( $type = self::SECONDARY_RESULTS)

Check if there are results on other wikis.

Parameters
int$type
Returns
bool

Implemented in SearchResultSet.

◆ hasMoreResults()

ISearchResultSet::hasMoreResults ( )
Returns
bool True when there are more pages of search results available.

Implemented in SearchResultSet.

◆ hasRewrittenQuery()

ISearchResultSet::hasRewrittenQuery ( )

Some search modes will run an alternative query that it thinks gives a better result than the provided search.

Returns true if this has occurred.

NOTE: In practice this has only been applied when the original query returned no results. UI messages, such as search-rewritten, have this assumption baked in.

Returns
bool

Implemented in SearchResultSet.

Referenced by MediaWiki\Search\SearchWidgets\DidYouMeanWidget\render().

◆ hasSuggestion()

ISearchResultSet::hasSuggestion ( )

Some search modes return a suggested alternate term if there are no exact hits.

Returns true if there is one on this set.

Returns
bool

Implemented in SearchResultSet.

Referenced by MediaWiki\Search\SearchWidgets\DidYouMeanWidget\render().

◆ numRows()

ISearchResultSet::numRows ( )

◆ searchContainedSyntax()

ISearchResultSet::searchContainedSyntax ( )

Did the search contain search syntax? If so, Special:Search won't offer the user a link to a create a page named by the search string because the name would contain the search syntax.

Returns
bool

Implemented in SearchResultSet.

◆ setAugmentedData()

ISearchResultSet::setAugmentedData ( $name,
$data )

Sets augmented data for result set.

Parameters
string$nameExtra data item name
array[]$dataExtra data as PAGEID => data

Referenced by SearchEngine\augmentSearchResults().

◆ shrink()

ISearchResultSet::shrink ( $limit)
Parameters
int$limitShrink result set to $limit and flag if more results are available.

Implemented in SearchResultSet.

Member Data Documentation

◆ INLINE_RESULTS

const ISearchResultSet::INLINE_RESULTS = 1

Identifier for interwiki results that can be displayed even if no existing main wiki results exist.

Definition at line 25 of file ISearchResultSet.php.

◆ SECONDARY_RESULTS

const ISearchResultSet::SECONDARY_RESULTS = 0

Identifier for interwiki results that are displayed only together with existing main wiki results.

Definition at line 19 of file ISearchResultSet.php.


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