aboutsummaryrefslogtreecommitdiff
path: root/mod/search/search_hooks.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-10 03:48:41 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-10 03:48:41 +0000
commit12779ad9e454aa4872bf564849f94db0081a7cd9 (patch)
tree6d690da07feaeb7e7f66beb3680db63fc1e685d9 /mod/search/search_hooks.php
parentfcaf7ad2e618deb50cbe48d2a4f8256e87878761 (diff)
downloadelgg-12779ad9e454aa4872bf564849f94db0081a7cd9.tar.gz
elgg-12779ad9e454aa4872bf564849f94db0081a7cd9.tar.bz2
Trying out the new context grabbing function in search.
git-svn-id: http://code.elgg.org/elgg/trunk@3652 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/search/search_hooks.php')
-rw-r--r--mod/search/search_hooks.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php
index 941e01e8c..f7a49400f 100644
--- a/mod/search/search_hooks.php
+++ b/mod/search/search_hooks.php
@@ -43,10 +43,12 @@ function search_objects_hook($hook, $type, $value, $params) {
// add the volatile data for why these entities have been returned.
foreach ($entities as $entity) {
//$title = search_get_highlighted_relevant_substrings($entity->title, $params['query']);
- $title = search_get_relevant_substring($entity->title, $params['query'], '<strong class="searchMatch">', '</strong>');
+ //$title = search_get_relevant_substring($entity->title, $params['query'], '<strong class="searchMatch">', '</strong>');
+ $title = search_get_highlighted_relevant_substrings($entity->title, $params['query']);
$entity->setVolatileData('search_matched_title', $title);
- $desc = search_get_relevant_substring($entity->description, $params['query'], '<strong class="searchMatch">', '</strong>');
+ //$desc = search_get_relevant_substring($entity->description, $params['query'], '<strong class="searchMatch">', '</strong>');
+ $desc = search_get_highlighted_relevant_substrings($entity->description, $params['query']);
$entity->setVolatileData('search_matched_description', $desc);
}
@@ -91,10 +93,10 @@ function search_groups_hook($hook, $type, $value, $params) {
// add the volatile data for why these entities have been returned.
foreach ($entities as $entity) {
- $description = search_get_relevant_substring($entity->description, $query, '<strong class="searchMatch">', '</strong>');
+ $description = search_get_highlighted_relevant_substrings($entity->description, $query);
$entity->setVolatileData('search_matched_title', $description);
- $name = search_get_relevant_substring($entity->name, $query, '<strong class="searchMatch">', '</strong>');
+ $name = search_get_highlighted_relevant_substrings($entity->name, $query);
$entity->setVolatileData('search_matched_description', $name);
}
@@ -139,10 +141,10 @@ function search_users_hook($hook, $type, $value, $params) {
// add the volatile data for why these entities have been returned.
foreach ($entities as $entity) {
- $username = search_get_relevant_substring($entity->username, $query, '<strong class="searchMatch">', '</strong>');
+ $username = search_get_highlighted_relevant_substrings($entity->username, $query);
$entity->setVolatileData('search_matched_title', $username);
- $name = search_get_relevant_substring($entity->name, $query, '<strong class="searchMatch">', '</strong>');
+ $name = search_get_highlighted_relevant_substrings($entity->name, $query);
$entity->setVolatileData('search_matched_description', $name);
}
@@ -180,7 +182,7 @@ 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_str = search_get_relevant_substring($tags, $query, '<strong class="searchMatch">', '</strong>');
+ $tags_str = search_get_highlighted_relevant_substrings($tags, $params['query']);
$entity->setVolatileData('search_matched_tags', $tags_str);
}
@@ -253,7 +255,7 @@ function search_comments_hook($hook, $type, $value, $params) {
if (!$entity = get_entity($comment->entity_guid)) {
continue;
}
- $comment_str = search_get_relevant_substring($comment->comment, $query, '<strong class="searchMatch">', '</strong>');
+ $comment_str = search_get_highlighted_relevant_substrings($comment->comment, $query);
$entity->setVolatileData('search_matched_comment', $comment_str);
$entity->setVolatileData('search_matched_comment_owner_guid', $comment->owner_guid);
$entity->setVolatileData('search_matched_comment_time_created', $comment->time_created);