6 interface ISearchResultSet
extends \Countable
, \IteratorAggregate
{
8 * Identifier for interwiki results that are displayed only together with existing main wiki
11 const SECONDARY_RESULTS
= 0;
14 * Identifier for interwiki results that can be displayed even if no existing main wiki results
17 const INLINE_RESULTS
= 1;
25 * Some search modes return a total hit count for the query
26 * in the entire article database. This may include pages
27 * in namespaces that would not be matched on the given
30 * Return null if no total hits number is supported.
34 function getTotalHits();
37 * Some search modes will run an alternative query that it thinks gives
38 * a better result than the provided search. Returns true if this has
43 function hasRewrittenQuery();
46 * @return string|null The search the query was internally rewritten to,
47 * or null when the result of the original query was returned.
49 function getQueryAfterRewrite();
52 * @return string|null Same as self::getQueryAfterRewrite(), but in HTML
53 * and with changes highlighted. Null when the query was not rewritten.
55 function getQueryAfterRewriteSnippet();
58 * Some search modes return a suggested alternate term if there are
59 * no exact hits. Returns true if there is one on this set.
63 function hasSuggestion();
66 * @return string|null Suggested query, null if none
68 function getSuggestionQuery();
71 * @return string HTML highlighted suggested query, '' if none
73 function getSuggestionSnippet();
76 * Return a result set of hits on other (multiple) wikis associated with this one
79 * @return ISearchResultSet[]
81 function getInterwikiResults( $type = self
::SECONDARY_RESULTS
);
84 * Check if there are results on other wikis
89 function hasInterwikiResults( $type = self
::SECONDARY_RESULTS
);
92 * Did the search contain search syntax? If so, Special:Search won't offer
93 * the user a link to a create a page named by the search string because the
94 * name would contain the search syntax.
97 public function searchContainedSyntax();
100 * @return bool True when there are more pages of search results available.
102 public function hasMoreResults();
105 * @param int $limit Shrink result set to $limit and flag
106 * if more results are available.
108 public function shrink( $limit );
111 * Extract all the results in the result set as array.
112 * @return SearchResult[]
114 public function extractResults();
117 * Extract all the titles in the result set.
120 public function extractTitles();
123 * Sets augmented data for result set.
124 * @param string $name Extra data item name
125 * @param array[] $data Extra data as PAGEID => data
127 public function setAugmentedData( $name, $data );
130 * Returns extra data for specific result and store it in SearchResult object.
131 * @param SearchResult $result
133 public function augmentResult( SearchResult
$result );
136 * @return int|null The offset the current page starts at. Typically
137 * this should be null to allow the UI to decide on its own, but in
138 * special cases like interleaved AB tests specifying explicitly is
141 public function getOffset();