aboutsummaryrefslogtreecommitdiff
path: root/mod/search/search_hooks.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-30 22:51:07 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-30 22:51:07 +0000
commit6a072f3454cd7af60875b080de5246a957b6abbd (patch)
treeade00bec7614b4244aad921275beca7768eb550a /mod/search/search_hooks.php
parent1786bdfe37c2636a6a1d3c96d42fb5dc65c13870 (diff)
downloadelgg-6a072f3454cd7af60875b080de5246a957b6abbd.tar.gz
elgg-6a072f3454cd7af60875b080de5246a957b6abbd.tar.bz2
Removed tag search listing.
Added ability to provide extra info in searches as 'search_matched_extra'. Allowing overrides for titles. git-svn-id: http://code.elgg.org/elgg/trunk@3711 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/search/search_hooks.php')
-rw-r--r--mod/search/search_hooks.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php
index 8f0a62703..8eff06359 100644
--- a/mod/search/search_hooks.php
+++ b/mod/search/search_hooks.php
@@ -181,9 +181,17 @@ function search_tags_hook($hook, $type, $value, $params) {
// add the volatile data for why these entities have been returned.
foreach ($entities as $entity) {
- $tags = implode(',', $entity->tags);
+ $tags = $entity->tags;
+
+ if (is_array($tags)) {
+ $tags = implode(', ', $entity->tags);
+ }
+
$tags_str = search_get_highlighted_relevant_substrings($tags, $params['query']);
- $entity->setVolatileData('search_matched_tags', $tags_str);
+ $tags_str = '(' . elgg_echo('tags') . ": $tags_str)";
+ $entity->setVolatileData('search_matched_title', $entity->title);
+ $entity->setVolatileData('search_matched_description', $entity->description);
+ $entity->setVolatileData('search_matched_extra', $tags_str);
}
return array(
@@ -264,6 +272,11 @@ function search_comments_hook($hook, $type, $value, $params) {
$result = get_data($q);
$count = $result[0]->total;
+
+ if (!is_array($comments)) {
+ return FALSE;
+ }
+
// @todo if plugins are disabled causing subtypes
// to be invalid and there are comments on entities of those subtypes,
// the counts will be wrong here and results might not show up correctly,