Looks like the Search API function setComment() is not required after all (cf. bug #0000902) HEAD
authorSami Barakat
Sun Oct 18 02:05:53 2009 +0100 (3 months ago)
branchHEAD
changeset 738739932e68c099
parent 7386c0af5c30022f
child 7388dbf2c1e5cedc
Looks like the Search API function setComment() is not required after all (cf. bug #0000902)
system/classes/search.class.php
system/classes/searchcriteria.class.php
system/lib-plugins.php
     1.1 --- a/system/classes/search.class.php	Sat Oct 17 23:00:40 2009 +0200
     1.2 +++ b/system/classes/search.class.php	Sun Oct 18 02:05:53 2009 +0100
     1.3 @@ -412,7 +412,6 @@
     1.4          $search_c->setSQL($sql);
     1.5          $search_c->setFTSQL($ftsql);
     1.6          $search_c->setRank(2);
     1.7 -        $search_c->setComment(true);
     1.8  
     1.9          return array($search_s, $search_c);
    1.10      }
    1.11 @@ -510,10 +509,7 @@
    1.12          $result_plugins = PLG_doSearch($this->_query, $this->_dateStart, $this->_dateEnd, $this->_topic, $this->_type, $this->_author, $this->_keyType, $page, 5);
    1.13  
    1.14          // Add core searches
    1.15 -        if ($this->_type == 'all' || $this->_type == 'stories' || $this->_type == 'comments')
    1.16 -        {
    1.17 -            $result_plugins = array_merge($result_plugins, $this->_searchStories());
    1.18 -        }
    1.19 +        $result_plugins = array_merge($result_plugins, $this->_searchStories());
    1.20  
    1.21          // Loop through all plugins separating the new API from the old
    1.22          $new_api = 0;
    1.23 @@ -524,9 +520,10 @@
    1.24          {
    1.25              if (is_a($result, 'SearchCriteria'))
    1.26              {
    1.27 -                if ($this->_type == 'comments' && !$result->getComment()) {
    1.28 +                if ($this->_type != 'all' && $this->_type != $result->getName())
    1.29 +                {
    1.30                      if ($this->_verbose) {
    1.31 -                        COM_errorLog($result->getName() . " using APIv2. Skipped as type is not comments");
    1.32 +                        COM_errorLog($result->getName() . " using APIv2. Skipped as type is not " . $this->_type);
    1.33                      }
    1.34                      continue;
    1.35                  }
     2.1 --- a/system/classes/searchcriteria.class.php	Sat Oct 17 23:00:40 2009 +0200
     2.2 +++ b/system/classes/searchcriteria.class.php	Sun Oct 18 02:05:53 2009 +0100
     2.3 @@ -41,7 +41,6 @@
     2.4      var $_url_rewrite;
     2.5      var $_append_query;
     2.6      var $_results = array();
     2.7 -    var $_is_comment;
     2.8  
     2.9      function SearchCriteria( $pluginName, $pluginLabel )
    2.10      {
    2.11 @@ -50,7 +49,6 @@
    2.12          $this->_rank = 3;
    2.13          $this->_url_rewrite = false;
    2.14          $this->_append_query = true;
    2.15 -        $this->_is_comment = false;
    2.16      }
    2.17  
    2.18      function setSQL( $sql )
    2.19 @@ -83,11 +81,6 @@
    2.20          $this->_results = $result_arr;
    2.21      }
    2.22  
    2.23 -    function setComment( $bool )
    2.24 -    {
    2.25 -        $this->_is_comment = $bool;
    2.26 -    }
    2.27 -
    2.28      function getSQL()
    2.29      {
    2.30          return $this->_sql;
    2.31 @@ -135,11 +128,6 @@
    2.32          return $this->_results;
    2.33      }
    2.34  
    2.35 -    function getComment()
    2.36 -    {
    2.37 -        return $this->_is_comment;
    2.38 -    }
    2.39 -
    2.40      function buildSearchSQL( $keyType, $query, $columns, $sql = '' )
    2.41      {
    2.42          if ($keyType == 'all')
     3.1 --- a/system/lib-plugins.php	Sat Oct 17 23:00:40 2009 +0200
     3.2 +++ b/system/lib-plugins.php	Sun Oct 18 02:05:53 2009 +0100
     3.3 @@ -778,21 +778,6 @@
     3.4  
     3.5      $search_results = array();
     3.6  
     3.7 -    // Search a single plugin if needed
     3.8 -    if ($type != 'all') {
     3.9 -        $function = 'plugin_dopluginsearch_' . $type;
    3.10 -        if (function_exists($function)) {
    3.11 -            $result = $function($query, $datestart, $dateend, $topic, $type, $author, $keyType, $page, $perpage);
    3.12 -            if (is_array($result)) {
    3.13 -                $search_results = array_merge($search_results, $result);
    3.14 -            } else {
    3.15 -                $search_results[] = $result;
    3.16 -            }
    3.17 -        }
    3.18 -
    3.19 -        return $search_results;
    3.20 -    }
    3.21 -
    3.22      foreach ($_PLUGINS as $pi_name) {
    3.23          $function = 'plugin_dopluginsearch_' . $pi_name;
    3.24          if (function_exists($function)) {