Remove SearchResultTooMany
authorChad Horohoe <chadh@wikimedia.org>
Fri, 20 Jun 2014 17:34:26 +0000 (10:34 -0700)
committerChad Horohoe <chadh@wikimedia.org>
Fri, 20 Jun 2014 17:36:47 +0000 (10:36 -0700)
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
includes/search/SearchEngine.php
includes/search/SearchPostgres.php
includes/specials/SpecialSearch.php
languages/i18n/en.json

index d547cb1..81c057d 100644 (file)
@@ -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',
 
index 4663ab8..3a3baef 100644 (file)
@@ -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,
index 42b67f3..43fb016 100644 (file)
@@ -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 );
        }
 
index 1cc5930..15b93ae 100644 (file)
@@ -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 ) );
index ac5bf85..f5894ad 100644 (file)
        "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",