Index: trunk/phase3/includes/SearchMySQL.php |
— | — | @@ -148,14 +148,28 @@ |
149 | 149 | * @return MySQLSearchResultSet |
150 | 150 | */ |
151 | 151 | function searchText( $term ) { |
| 152 | + return $this->searchInternal( $term, true ); |
| 153 | + } |
| 154 | + |
| 155 | + /** |
| 156 | + * Perform a title-only search query and return a result set. |
| 157 | + * |
| 158 | + * @param $term String: raw search term |
| 159 | + * @return MySQLSearchResultSet |
| 160 | + */ |
| 161 | + function searchTitle( $term ) { |
| 162 | + return $this->searchInternal( $term, false ); |
| 163 | + } |
| 164 | + |
| 165 | + protected function searchInternal( $term, $fulltext ) { |
152 | 166 | global $wgSearchMySQLTotalHits; |
153 | 167 | |
154 | 168 | $filteredTerm = $this->filter( $term ); |
155 | | - $resultSet = $this->db->query( $this->getQuery( $filteredTerm, true ) ); |
| 169 | + $resultSet = $this->db->query( $this->getQuery( $filteredTerm, $fulltext ) ); |
156 | 170 | |
157 | 171 | $total = null; |
158 | 172 | if( $wgSearchMySQLTotalHits ) { |
159 | | - $totalResult = $this->db->query( $this->getCountQuery( $filteredTerm, true ) ); |
| 173 | + $totalResult = $this->db->query( $this->getCountQuery( $filteredTerm, $fulltext ) ); |
160 | 174 | $row = $totalResult->fetchObject(); |
161 | 175 | if( $row ) { |
162 | 176 | $total = $row->c; |
— | — | @@ -166,18 +180,7 @@ |
167 | 181 | return new MySQLSearchResultSet( $resultSet, $this->searchTerms, $total ); |
168 | 182 | } |
169 | 183 | |
170 | | - /** |
171 | | - * Perform a title-only search query and return a result set. |
172 | | - * |
173 | | - * @param $term String: raw search term |
174 | | - * @return MySQLSearchResultSet |
175 | | - */ |
176 | | - function searchTitle( $term ) { |
177 | | - $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) ); |
178 | | - return new MySQLSearchResultSet( $resultSet, $this->searchTerms ); |
179 | | - } |
180 | 184 | |
181 | | - |
182 | 185 | /** |
183 | 186 | * Return a partial WHERE clause to exclude redirects, if so set |
184 | 187 | * @return String |