From 24e3ff747614364d0d44fc1a7644f164146c66e1 Mon Sep 17 00:00:00 2001 From: brettp Date: Sat, 7 Nov 2009 20:57:32 +0000 Subject: 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 --- engine/lib/group.php | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'engine/lib/group.php') diff --git a/engine/lib/group.php b/engine/lib/group.php index f7acd9fba..e85724ece 100644 --- a/engine/lib/group.php +++ b/engine/lib/group.php @@ -945,58 +945,6 @@ function list_group_search($tag, $limit = 10) { function group_init() { // Register an entity type register_entity_type('group',''); - - // Register a search hook - register_plugin_hook('search', 'group', 'groups_search_hook'); -} - - -/** - * Return default results for searches on groups. - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - * @return unknown_type - */ -function groups_search_hook($hook, $type, $value, $params) { - global $CONFIG; - - $query = $params['query']; - - $join = "JOIN {$CONFIG->dbprefix}groups_entity ge ON e.guid = ge.guid"; - $params['joins'] = array($join); - - $where = "(ge.guid = e.guid - AND (ge.name LIKE '%$query%' - OR ge.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) { - $description = search_get_relevant_substring($entity->description, $query, '', ''); - $entity->setVolatileData('search_matched_title', $description); - - $name = search_get_relevant_substring($entity->name, $query, '', ''); - $entity->setVolatileData('search_matched_description', $name); - } - - return array( - 'entities' => $entities, - 'count' => $count, - ); } register_elgg_event_handler('init','system','group_init'); -- cgit v1.2.3