[geeklog-cvs] geeklog: Allow external apps to contribute to search results (fe...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Mon Sep 21 17:42:23 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/0b090631301e
changeset: 7334:0b090631301e
user: Sami Barakat
date: Mon Sep 21 22:40:37 2009 +0100
description:
Allow external apps to contribute to search results (feature request #0000985)
diffstat:
system/classes/listfactory.class.php | 16 ++++++++++++++--
system/classes/search.class.php | 5 +++++
system/classes/searchcriteria.class.php | 13 ++++++++++++-
3 files changed, 31 insertions(+), 3 deletions(-)
diffs (94 lines):
diff -r 65bb4649e883 -r 0b090631301e system/classes/listfactory.class.php
--- a/system/classes/listfactory.class.php Mon Sep 21 20:23:48 2009 +0100
+++ b/system/classes/listfactory.class.php Mon Sep 21 22:40:37 2009 +0100
@@ -251,10 +251,10 @@
}
/**
- * Appends a result to the list
+ * Appends a single result to the list
*
* @access public
- * @param array $result An single result that will be appended to the rest
+ * @param array $result A single result that will be appended to the rest
*
*/
function addResult( $result )
@@ -263,6 +263,18 @@
}
/**
+ * Appends several results to the list
+ *
+ * @access public
+ * @param array $result An array of result that will be appended to the rest
+ *
+ */
+ function addResultArray( $arr )
+ {
+ $this->_preset_rows = array_merge($this->_preset_rows, $arr);
+ }
+
+ /**
* Gets the total number of results from a query
*
* @access private
diff -r 65bb4649e883 -r 0b090631301e system/classes/search.class.php
--- a/system/classes/search.class.php Mon Sep 21 20:23:48 2009 +0100
+++ b/system/classes/search.class.php Mon Sep 21 22:40:37 2009 +0100
@@ -583,6 +583,11 @@
COM_errorLog($debug_info);
}
+ $api_results = $result->getResults();
+ if (!empty($api_results)) {
+ $obj->addResultArray($api_results);
+ }
+
$obj->setQuery($result->getLabel(), $result->getName(), $sql, $result->getRank());
$this->_url_rewrite[ $result->getName() ] = $result->UrlRewriteEnable();
$this->_append_query[ $result->getName() ] = $result->AppendQueryEnable();
diff -r 65bb4649e883 -r 0b090631301e system/classes/searchcriteria.class.php
--- a/system/classes/searchcriteria.class.php Mon Sep 21 20:23:48 2009 +0100
+++ b/system/classes/searchcriteria.class.php Mon Sep 21 22:40:37 2009 +0100
@@ -40,6 +40,7 @@
var $_rank;
var $_url_rewrite;
var $_append_query;
+ var $_results = array();
function SearchCriteria( $pluginName, $pluginLabel )
{
@@ -75,6 +76,11 @@
$this->_append_query = $append_query;
}
+ function setResults( $result_arr )
+ {
+ $this->_results = $result_arr;
+ }
+
function getSQL()
{
return $this->_sql;
@@ -117,6 +123,11 @@
return $this->_append_query;
}
+ function getResults()
+ {
+ return $this->_results;
+ }
+
function buildSearchSQL( $keyType, $query, $columns, $sql = '' )
{
if ($keyType == 'all')
@@ -167,7 +178,7 @@
{
$word = trim($word);
$tmp .= '(';
-
+
if ($titles) {
$tmp .= $columns['title'] . " LIKE '%$word%' OR ";
} else {
More information about the geeklog-cvs
mailing list