[geeklog-cvs] geeklog: Looks like the Search API function setComment() is not ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Oct 17 21:08:06 EDT 2009


changeset 7387:39932e68c099
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/39932e68c099
user: Sami Barakat
date: Sun Oct 18 02:05:53 2009 +0100
description:
Looks like the Search API function setComment() is not required after all (cf. bug #0000902)

diffstat:

 system/classes/search.class.php         |  11 ++++-------
 system/classes/searchcriteria.class.php |  12 ------------
 system/lib-plugins.php                  |  15 ---------------
 3 files changed, 4 insertions(+), 34 deletions(-)

diffs (104 lines):

diff -r c0af5c30022f -r 39932e68c099 system/classes/search.class.php
--- a/system/classes/search.class.php	Sat Oct 17 23:00:40 2009 +0200
+++ b/system/classes/search.class.php	Sun Oct 18 02:05:53 2009 +0100
@@ -412,7 +412,6 @@
         $search_c->setSQL($sql);
         $search_c->setFTSQL($ftsql);
         $search_c->setRank(2);
-        $search_c->setComment(true);
 
         return array($search_s, $search_c);
     }
@@ -510,10 +509,7 @@
         $result_plugins = PLG_doSearch($this->_query, $this->_dateStart, $this->_dateEnd, $this->_topic, $this->_type, $this->_author, $this->_keyType, $page, 5);
 
         // Add core searches
-        if ($this->_type == 'all' || $this->_type == 'stories' || $this->_type == 'comments')
-        {
-            $result_plugins = array_merge($result_plugins, $this->_searchStories());
-        }
+        $result_plugins = array_merge($result_plugins, $this->_searchStories());
 
         // Loop through all plugins separating the new API from the old
         $new_api = 0;
@@ -524,9 +520,10 @@
         {
             if (is_a($result, 'SearchCriteria'))
             {
-                if ($this->_type == 'comments' && !$result->getComment()) {
+                if ($this->_type != 'all' && $this->_type != $result->getName())
+                {
                     if ($this->_verbose) {
-                        COM_errorLog($result->getName() . " using APIv2. Skipped as type is not comments");
+                        COM_errorLog($result->getName() . " using APIv2. Skipped as type is not " . $this->_type);
                     }
                     continue;
                 }
diff -r c0af5c30022f -r 39932e68c099 system/classes/searchcriteria.class.php
--- a/system/classes/searchcriteria.class.php	Sat Oct 17 23:00:40 2009 +0200
+++ b/system/classes/searchcriteria.class.php	Sun Oct 18 02:05:53 2009 +0100
@@ -41,7 +41,6 @@
     var $_url_rewrite;
     var $_append_query;
     var $_results = array();
-    var $_is_comment;
 
     function SearchCriteria( $pluginName, $pluginLabel )
     {
@@ -50,7 +49,6 @@
         $this->_rank = 3;
         $this->_url_rewrite = false;
         $this->_append_query = true;
-        $this->_is_comment = false;
     }
 
     function setSQL( $sql )
@@ -83,11 +81,6 @@
         $this->_results = $result_arr;
     }
 
-    function setComment( $bool )
-    {
-        $this->_is_comment = $bool;
-    }
-
     function getSQL()
     {
         return $this->_sql;
@@ -135,11 +128,6 @@
         return $this->_results;
     }
 
-    function getComment()
-    {
-        return $this->_is_comment;
-    }
-
     function buildSearchSQL( $keyType, $query, $columns, $sql = '' )
     {
         if ($keyType == 'all')
diff -r c0af5c30022f -r 39932e68c099 system/lib-plugins.php
--- a/system/lib-plugins.php	Sat Oct 17 23:00:40 2009 +0200
+++ b/system/lib-plugins.php	Sun Oct 18 02:05:53 2009 +0100
@@ -778,21 +778,6 @@
 
     $search_results = array();
 
-    // Search a single plugin if needed
-    if ($type != 'all') {
-        $function = 'plugin_dopluginsearch_' . $type;
-        if (function_exists($function)) {
-            $result = $function($query, $datestart, $dateend, $topic, $type, $author, $keyType, $page, $perpage);
-            if (is_array($result)) {
-                $search_results = array_merge($search_results, $result);
-            } else {
-                $search_results[] = $result;
-            }
-        }
-
-        return $search_results;
-    }
-
     foreach ($_PLUGINS as $pi_name) {
         $function = 'plugin_dopluginsearch_' . $pi_name;
         if (function_exists($function)) {



More information about the geeklog-cvs mailing list