4 * A set of SearchEngine results.
5 * Must not be directly implemented by extension, please extend BaseSearchResultSet instead.
6 * This interface must only be used for type hinting.
8 * @see BaseSearchResultSet
11 interface ISearchResultSet
extends \Countable
, \IteratorAggregate
{
13 * Identifier for interwiki results that are displayed only together with existing main wiki
16 const SECONDARY_RESULTS
= 0;
19 * Identifier for interwiki results that can be displayed even if no existing main wiki results
22 const INLINE_RESULTS
= 1;
27 public function numRows();
30 * Some search modes return a total hit count for the query
31 * in the entire article database. This may include pages
32 * in namespaces that would not be matched on the given
35 * Return null if no total hits number is supported.
39 public function getTotalHits();
42 * Some search modes will run an alternative query that it thinks gives
43 * a better result than the provided search. Returns true if this has
48 public function hasRewrittenQuery();
51 * @return string|null The search the query was internally rewritten to,
52 * or null when the result of the original query was returned.
54 public function getQueryAfterRewrite();
57 * @return string|null Same as self::getQueryAfterRewrite(), but in HTML
58 * and with changes highlighted. Null when the query was not rewritten.
60 public function getQueryAfterRewriteSnippet();
63 * Some search modes return a suggested alternate term if there are
64 * no exact hits. Returns true if there is one on this set.
68 public function hasSuggestion();
71 * @return string|null Suggested query, null if none
73 public function getSuggestionQuery();
76 * @return string HTML highlighted suggested query, '' if none
78 public function getSuggestionSnippet();
81 * Return a result set of hits on other (multiple) wikis associated with this one
84 * @return ISearchResultSet[]
86 public function getInterwikiResults( $type = self
::SECONDARY_RESULTS
);
89 * Check if there are results on other wikis
94 public function hasInterwikiResults( $type = self
::SECONDARY_RESULTS
);
97 * Did the search contain search syntax? If so, Special:Search won't offer
98 * the user a link to a create a page named by the search string because the
99 * name would contain the search syntax.
102 public function searchContainedSyntax();
105 * @return bool True when there are more pages of search results available.
107 public function hasMoreResults();
110 * @param int $limit Shrink result set to $limit and flag
111 * if more results are available.
113 public function shrink( $limit );
116 * Extract all the results in the result set as array.
117 * @return SearchResult[]
119 public function extractResults();
122 * Extract all the titles in the result set.
125 public function extractTitles();
128 * Sets augmented data for result set.
129 * @param string $name Extra data item name
130 * @param array[] $data Extra data as PAGEID => data
132 public function setAugmentedData( $name, $data );
135 * Returns extra data for specific result and store it in SearchResult object.
136 * @param SearchResult $result
138 public function augmentResult( SearchResult
$result );
141 * @return int|null The offset the current page starts at. Typically
142 * this should be null to allow the UI to decide on its own, but in
143 * special cases like interleaved AB tests specifying explicitly is
146 public function getOffset();