From 9643a0a92d893e6b6b4bf8d9c638438917d575af Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 20 Jun 2014 10:34:26 -0700 Subject: [PATCH] Remove SearchResultTooMany Only worked for Postgres, and only worked halfway at that. Result sets could be false for many reasons. No results, bad query, database went to Mars. We shouldn't assume they're always "too many results." Leave it up to the normal query error logging and move on. Change-Id: Ieddd163e440ae54b152541d727c1afdbc4ab4fbd --- includes/AutoLoader.php | 1 - includes/search/SearchEngine.php | 7 ------- includes/search/SearchPostgres.php | 7 ------- includes/specials/SpecialSearch.php | 11 +---------- languages/i18n/en.json | 1 - 5 files changed, 1 insertion(+), 26 deletions(-) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index d547cb1c07..81c057d67d 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -909,7 +909,6 @@ $wgAutoloadLocalClasses = array( 'SearchPostgres' => 'includes/search/SearchPostgres.php', 'SearchResult' => 'includes/search/SearchResult.php', 'SearchResultSet' => 'includes/search/SearchResultSet.php', - 'SearchResultTooMany' => 'includes/search/SearchEngine.php', 'SearchSqlite' => 'includes/search/SearchSqlite.php', 'SqlSearchResultSet' => 'includes/search/SearchResultSet.php', diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 4663ab886c..3a3baef18c 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -555,13 +555,6 @@ class SearchEngine { } } -/** - * @ingroup Search - */ -class SearchResultTooMany { - # # Some search engines may bail out if too many matches are found -} - /** * Dummy class to be used when non-supported Database engine is present. * @todo FIXME: Dummy class should probably try something at least mildly useful, diff --git a/includes/search/SearchPostgres.php b/includes/search/SearchPostgres.php index 42b67f3679..43fb0169d5 100644 --- a/includes/search/SearchPostgres.php +++ b/includes/search/SearchPostgres.php @@ -42,10 +42,6 @@ class SearchPostgres extends SearchDatabase { $olderror = error_reporting( E_ERROR ); $resultSet = $this->db->resultObject( $this->db->query( $q, 'SearchPostgres', true ) ); error_reporting( $olderror ); - if ( !$resultSet ) { - // Needed for "Query requires full scan, GIN doesn't support it" - return new SearchResultTooMany(); - } return new PostgresSearchResultSet( $resultSet, $this->searchTerms ); } @@ -54,9 +50,6 @@ class SearchPostgres extends SearchDatabase { $olderror = error_reporting( E_ERROR ); $resultSet = $this->db->resultObject( $this->db->query( $q, 'SearchPostgres', true ) ); error_reporting( $olderror ); - if ( !$resultSet ) { - return new SearchResultTooMany(); - } return new PostgresSearchResultSet( $resultSet, $this->searchTerms ); } diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 1cc5930ac7..15b93ae5f2 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -253,9 +253,7 @@ class SpecialSearch extends SpecialPage { $rewritten = $search->replacePrefixes( $term ); $titleMatches = $search->searchTitle( $rewritten ); - if ( !( $titleMatches instanceof SearchResultTooMany ) ) { - $textMatches = $search->searchText( $rewritten ); - } + $textMatches = $search->searchText( $rewritten ); $textStatus = null; if ( $textMatches instanceof Status ) { @@ -319,13 +317,6 @@ class SpecialSearch extends SpecialPage { Xml::closeElement( 'div' ) ); - // Sometimes the search engine knows there are too many hits - if ( $titleMatches instanceof SearchResultTooMany ) { - $out->wrapWikiMsg( "==$1==\n", 'toomanymatches' ); - - return; - } - $filePrefix = $wgContLang->getFormattedNsText( NS_FILE ) . ':'; if ( trim( $term ) === '' || $filePrefix === trim( $term ) ) { $out->addHTML( $this->formHeader( $term, 0, 0 ) ); diff --git a/languages/i18n/en.json b/languages/i18n/en.json index ac5bf85b16..f5894ade0e 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -869,7 +869,6 @@ "search-summary": "", "searchresults": "Search results", "searchresults-title": "Search results for \"$1\"", - "toomanymatches": "Too many matches were returned, please try a different query", "titlematches": "Page title matches", "textmatches": "Page text matches", "notextmatches": "No page text matches", -- 2.20.1