prefixes (i.e. turned into interlanguage links when $wgInterwikiMagic is set
to true).
* $wgParserTestRemote has been removed.
+* $wgCountTotalSearchHits has been removed. If you're concerned about efficiency
+ of search, you should use something like CirrusSearch instead of built in
+ search.
=== New features in 1.24 ===
* Added a new hook, "WhatLinksHereProps", to allow extensions to annotate
*/
$wgSearchHighlightBoundaries = '[\p{Z}\p{P}\p{C}]';
-/**
- * Set to true to have the search engine count total
- * search matches to present in the Special:Search UI.
- * Not supported by every search engine shipped with MW.
- *
- * This could however be slow on larger wikis, and is pretty flaky
- * with the current title vs content split. Recommend avoiding until
- * that's been worked out cleanly; but this may aid in testing the
- * search UI and API to confirm that the result count works.
- */
-$wgCountTotalSearchHits = false;
-
/**
* Template for OpenSearch suggestions, defaults to API action=opensearch
*
}
protected function searchInternal( $term, $fulltext ) {
- global $wgCountTotalSearchHits;
-
// This seems out of place, why is this called with empty term?
if ( trim( $term ) === '' ) {
return null;
);
$total = null;
- if ( $wgCountTotalSearchHits ) {
- $query = $this->getCountQuery( $filteredTerm, $fulltext );
- $totalResult = $this->db->select(
- $query['tables'], $query['fields'], $query['conds'],
- __METHOD__, $query['options'], $query['joins']
- );
-
- $row = $totalResult->fetchObject();
- if ( $row ) {
- $total = intval( $row->c );
- }
- $totalResult->free();
+ $query = $this->getCountQuery( $filteredTerm, $fulltext );
+ $totalResult = $this->db->select(
+ $query['tables'], $query['fields'], $query['conds'],
+ __METHOD__, $query['options'], $query['joins']
+ );
+
+ $row = $totalResult->fetchObject();
+ if ( $row ) {
+ $total = intval( $row->c );
}
+ $totalResult->free();
return new SqlSearchResultSet( $resultSet, $this->searchTerms, $total );
}
}
function getTotalHits() {
- return $this->totalHits;
+ if ( !is_null( $this->totalHits ) ) {
+ return $this->totalHits;
+ } else {
+ // Special:Search expects a number here.
+ return $this->numRows();
+ }
}
}
}
protected function searchInternal( $term, $fulltext ) {
- global $wgCountTotalSearchHits, $wgContLang;
+ global $wgContLang;
if ( !$this->fulltextSearchSupported() ) {
return null;
$resultSet = $this->db->query( $this->getQuery( $filteredTerm, $fulltext ) );
$total = null;
- if ( $wgCountTotalSearchHits ) {
- $totalResult = $this->db->query( $this->getCountQuery( $filteredTerm, $fulltext ) );
- $row = $totalResult->fetchObject();
- if ( $row ) {
- $total = intval( $row->c );
- }
- $totalResult->free();
+ $totalResult = $this->db->query( $this->getCountQuery( $filteredTerm, $fulltext ) );
+ $row = $totalResult->fetchObject();
+ if ( $row ) {
+ $total = intval( $row->c );
}
+ $totalResult->free();
return new SqlSearchResultSet( $resultSet, $this->searchTerms, $total );
}