MediaWiki  1.34.0
ISearchResultSet Interface Reference

A set of SearchEngine results. More...

Inheritance diagram for ISearchResultSet:
Collaboration diagram for ISearchResultSet:

Public Member Functions

 augmentResult (SearchResult $result)
 Returns extra data for specific result and store it in SearchResult object. More...
 
 extractResults ()
 Extract all the results in the result set as array. More...
 
 extractTitles ()
 Extract all the titles in the result set. More...
 
 getInterwikiResults ( $type=self::SECONDARY_RESULTS)
 Return a result set of hits on other (multiple) wikis associated with this one. More...
 
 getOffset ()
 
 getQueryAfterRewrite ()
 
 getQueryAfterRewriteSnippet ()
 
 getSuggestionQuery ()
 
 getSuggestionSnippet ()
 
 getTotalHits ()
 Some search modes return a total hit count for the query in the entire article database. More...
 
 hasInterwikiResults ( $type=self::SECONDARY_RESULTS)
 Check if there are results on other wikis. More...
 
 hasMoreResults ()
 
 hasRewrittenQuery ()
 Some search modes will run an alternative query that it thinks gives a better result than the provided search. More...
 
 hasSuggestion ()
 Some search modes return a suggested alternate term if there are no exact hits. More...
 
 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. More...
 
 setAugmentedData ( $name, $data)
 Sets augmented data for result set. More...
 
 shrink ( $limit)
 

Public Attributes

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

Detailed Description

A set of SearchEngine results.

Must not be directly implemented by extension, please extend BaseSearchResultSet instead. This interface must only be used for type hinting.

See also
BaseSearchResultSet

Definition at line 11 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.

Referenced by AugmentPageProps\augmentAll().

◆ 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\Widget\Search\DidYouMeanWidget\rewrittenHtml().

◆ getQueryAfterRewriteSnippet()

ISearchResultSet::getQueryAfterRewriteSnippet ( )
Returns
string|null Same as self::getQueryAfterRewrite(), but in HTML and with changes highlighted. Null when the query was not rewritten.

Implemented in SearchResultSet.

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

◆ getSuggestionQuery()

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

Implemented in SearchResultSet.

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

◆ getSuggestionSnippet()

ISearchResultSet::getSuggestionSnippet ( )
Returns
string HTML highlighted suggested query, '' if none

Implemented in SearchResultSet.

Referenced by MediaWiki\Widget\Search\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 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.

Returns
bool

Implemented in SearchResultSet.

Referenced by MediaWiki\Widget\Search\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\Widget\Search\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 22 of file ISearchResultSet.php.

Referenced by MediaWiki\Widget\Search\BasicSearchResultSetWidget\render(), ApiQuerySearch\run(), and SpecialSearch\showResults().

◆ SECONDARY_RESULTS

const ISearchResultSet::SECONDARY_RESULTS = 0

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

Definition at line 16 of file ISearchResultSet.php.

Referenced by MediaWiki\Widget\Search\BasicSearchResultSetWidget\render(), ApiQuerySearch\run(), and SpecialSearch\showResults().


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