diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-11-07 20:57:32 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-11-07 20:57:32 +0000 |
commit | 24e3ff747614364d0d44fc1a7644f164146c66e1 (patch) | |
tree | cab9495aa3a6daf5c1aa3bac6de61e3436e77380 /engine/lib/objects.php | |
parent | 413ea817c78a2cd7cbe3bebad1623daaaeea6394 (diff) | |
download | elgg-24e3ff747614364d0d44fc1a7644f164146c66e1.tar.gz elgg-24e3ff747614364d0d44fc1a7644f164146c66e1.tar.bz2 |
Moved default search hooks into search mod.
Using MySQL's MATCH ... AGAINST instead of likes for most searches.
Changed 'tag' to 'q' while maintaining backward compatibility.
git-svn-id: http://code.elgg.org/elgg/trunk@3633 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/objects.php')
-rw-r--r-- | engine/lib/objects.php | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/engine/lib/objects.php b/engine/lib/objects.php index b928af2fe..e4c3128b9 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -376,54 +376,5 @@ function search_list_objects_by_name($hook, $user, $returnvalue, $tag) { } } -/** - * Return default results for searches on objects. - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - * @return unknown_type - */ -function objects_search_hook($hook, $type, $value, $params) { - global $CONFIG; - - $query = $params['query']; - - $join = "JOIN {$CONFIG->dbprefix}objects_entity oe ON e.guid = oe.guid"; - $params['joins'] = array($join); - - $where = "(oe.guid = e.guid - AND (oe.title LIKE '%$query%' - OR oe.description LIKE '%$query%' - ) - )"; - $params['wheres'] = array($where); - - $entities = elgg_get_entities($params); - $params['count'] = TRUE; - $count = elgg_get_entities($params); - - // no need to continue if nothing here. - if (!$count) { - return array('entities' => array(), 'count' => $count); - } - - // add the volatile data for why these entities have been returned. - foreach ($entities as $entity) { - $title = search_get_relevant_substring($entity->title, $query, '<strong class="searchMatch">', '</strong>'); - $entity->setVolatileData('search_matched_title', $title); - - $desc = search_get_relevant_substring($entity->description, $query, '<strong class="searchMatch">', '</strong>'); - $entity->setVolatileData('search_matched_description', $desc); - } - - return array( - 'entities' => $entities, - 'count' => $count, - ); -} - register_elgg_event_handler('init', 'system', 'objects_init', 0); -register_plugin_hook('search', 'object', 'objects_search_hook'); register_plugin_hook('unit_test', 'system', 'objects_test');
\ No newline at end of file |