From 6a072f3454cd7af60875b080de5246a957b6abbd Mon Sep 17 00:00:00 2001 From: brettp Date: Mon, 30 Nov 2009 22:51:07 +0000 Subject: 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 --- mod/search/search_hooks.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'mod/search/search_hooks.php') 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, -- cgit v1.2.3