Expose $wgMaxArticleSize in siteinfo query api
[mediawiki.git] / includes / search / SearchResultSet.php
blob69795e792b0b052333934ec89fff51c504faf4b1
1 <?php
2 /**
3 * Search result sets
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @ingroup Search
24 /**
25 * @ingroup Search
27 class SearchResultSet {
29 /**
30 * Types of interwiki results
32 /**
33 * Results that are displayed only together with existing main wiki results
34 * @var int
36 const SECONDARY_RESULTS = 0;
37 /**
38 * Results that can displayed even if no existing main wiki results exist
39 * @var int
41 const INLINE_RESULTS = 1;
43 protected $containedSyntax = false;
45 public function __construct( $containedSyntax = false ) {
46 $this->containedSyntax = $containedSyntax;
49 /**
50 * Fetch an array of regular expression fragments for matching
51 * the search terms as parsed by this engine in a text extract.
52 * STUB
54 * @return array
56 function termMatches() {
57 return [];
60 function numRows() {
61 return 0;
64 /**
65 * Some search modes return a total hit count for the query
66 * in the entire article database. This may include pages
67 * in namespaces that would not be matched on the given
68 * settings.
70 * Return null if no total hits number is supported.
72 * @return int
74 function getTotalHits() {
75 return null;
78 /**
79 * Some search modes will run an alternative query that it thinks gives
80 * a better result than the provided search. Returns true if this has
81 * occured.
83 * @return bool
85 function hasRewrittenQuery() {
86 return false;
89 /**
90 * @return string|null The search the query was internally rewritten to,
91 * or null when the result of the original query was returned.
93 function getQueryAfterRewrite() {
94 return null;
97 /**
98 * @return string|null Same as self::getQueryAfterRewrite(), but in HTML
99 * and with changes highlighted. Null when the query was not rewritten.
101 function getQueryAfterRewriteSnippet() {
102 return null;
106 * Some search modes return a suggested alternate term if there are
107 * no exact hits. Returns true if there is one on this set.
109 * @return bool
111 function hasSuggestion() {
112 return false;
116 * @return string|null Suggested query, null if none
118 function getSuggestionQuery() {
119 return null;
123 * @return string HTML highlighted suggested query, '' if none
125 function getSuggestionSnippet() {
126 return '';
130 * Return a result set of hits on other (multiple) wikis associated with this one
132 * @return SearchResultSet[]
134 function getInterwikiResults( $type = self::SECONDARY_RESULTS ) {
135 return null;
139 * Check if there are results on other wikis
141 * @return bool
143 function hasInterwikiResults( $type = self::SECONDARY_RESULTS ) {
144 return false;
148 * Fetches next search result, or false.
149 * STUB
151 * @return SearchResult
153 function next() {
154 return false;
158 * Rewind result set back to begining
160 function rewind() {
164 * Frees the result set, if applicable.
166 function free() {
167 // ...
171 * Did the search contain search syntax? If so, Special:Search won't offer
172 * the user a link to a create a page named by the search string because the
173 * name would contain the search syntax.
174 * @return bool
176 public function searchContainedSyntax() {
177 return $this->containedSyntax;