Deprecate SearchResultSet::free
authorDavid Causse <dcausse@wikimedia.org>
Mon, 22 Jul 2019 10:08:32 +0000 (12:08 +0200)
committerDavid Causse <dcausse@wikimedia.org>
Mon, 22 Jul 2019 15:46:00 +0000 (17:46 +0200)
Was only called by SpecialSearch, according to IResultWrapper::free()
this method is rarely worth being called. Therefor it does not seem wise
to expose it in the upcoming interface defining a search result set.

Bug: T228626
Change-Id: I12d41a488025eb2d6dd543c9fbdc1c803c840316

RELEASE-NOTES-1.34
includes/search/SearchResultSet.php
includes/search/SqlSearchResultSet.php
includes/specials/SpecialSearch.php

index 57d635e..32a858b 100644 (file)
@@ -378,6 +378,7 @@ because of Phabricator reports.
   and should no longer be passed. Search engine implemenations should be
   responsible for carrying relevant information needed for highlighting with
   their own SearchResultSet/SearchResult sub-classes.
+* SearchResultSet::free() method is deprecated.
 * SearchEngine::$searchTerms protected field is deprecated. Moved to
   SearchDatabase.
 * The use of the $terms param in the ShowSearchHit and ShowSearchHitTitle
index 5ee96cb..38f83a9 100644 (file)
@@ -234,9 +234,9 @@ class SearchResultSet implements Countable, IteratorAggregate {
 
        /**
         * Frees the result set, if applicable.
+        * @deprecated noop since 1.34
         */
        function free() {
-               // ...
        }
 
        /**
index 87068ca..f5d795f 100644 (file)
@@ -66,14 +66,6 @@ class SqlSearchResultSet extends SearchResultSet {
                return $this->results;
        }
 
-       function free() {
-               if ( $this->resultSet === false ) {
-                       return;
-               }
-
-               $this->resultSet->free();
-       }
-
        function getTotalHits() {
                if ( !is_null( $this->totalHits ) ) {
                        return $this->totalHits;
index e1fbe6a..c746e78 100644 (file)
@@ -443,14 +443,6 @@ class SpecialSearch extends SpecialPage {
                        $term, $this->offset, $titleMatches, $textMatches
                ) );
 
-               if ( $titleMatches ) {
-                       $titleMatches->free();
-               }
-
-               if ( $textMatches ) {
-                       $textMatches->free();
-               }
-
                $out->addHTML( '<div class="mw-search-visualclear"></div>' );
 
                // prev/next links