aboutsummaryrefslogtreecommitdiff
path: root/mod/search/start.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-08 00:09:09 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-08 00:09:09 +0000
commitb02f17540195e1c9f933b40b0176a6f01bf1be6d (patch)
treeaa0b71e005f4b3dfe6ea96b10234ac31137e3753 /mod/search/start.php
parent963a9ab35f58f1f3ff5ca2822aed3b908717bb68 (diff)
downloadelgg-b02f17540195e1c9f933b40b0176a6f01bf1be6d.tar.gz
elgg-b02f17540195e1c9f933b40b0176a6f01bf1be6d.tar.bz2
Added super-basic support for searching comments.
git-svn-id: http://code.elgg.org/elgg/trunk@3636 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/search/start.php')
-rw-r--r--mod/search/start.php33
1 files changed, 19 insertions, 14 deletions
diff --git a/mod/search/start.php b/mod/search/start.php
index 47405450a..ad9604cb6 100644
--- a/mod/search/start.php
+++ b/mod/search/start.php
@@ -19,17 +19,20 @@ function search_init() {
// page handler for search actions and results
register_page_handler('search','search_page_handler');
- // register some default search hooks
- register_plugin_hook('search', 'object', 'search_objects_hook');
- register_plugin_hook('search', 'user', 'search_users_hook');
-
- // @todo pull this out into groups
- register_plugin_hook('search', 'group', 'search_groups_hook');
-
- // tags are a bit different.
- // register a custom search type and a hook for that.
- register_plugin_hook('search_types', 'get_types', 'search_custom_types_tags_hook');
- register_plugin_hook('search', 'tags', 'search_tags_hook');
+// // register some default search hooks
+// register_plugin_hook('search', 'object', 'search_objects_hook');
+// register_plugin_hook('search', 'user', 'search_users_hook');
+//
+// // @todo pull this out into groups
+// register_plugin_hook('search', 'group', 'search_groups_hook');
+//
+// // tags and comments are a bit different.
+// // register a search types and a hooks for them.
+// register_plugin_hook('search_types', 'get_types', 'search_custom_types_tags_hook');
+// register_plugin_hook('search', 'tags', 'search_tags_hook');
+
+ register_plugin_hook('search_types', 'get_types', 'search_custom_types_comments_hook');
+ register_plugin_hook('search', 'comments', 'search_comments_hook');
// get server min and max allowed chars for ft searching
$word_lens = get_data('SELECT @@ft_min_word_len as min, @@ft_max_word_len as max');
@@ -327,7 +330,8 @@ function search_get_where_sql($table, $fields, $params) {
$likes[] = "$field LIKE '%$query%'";
}
$likes_str = implode(' OR ', $likes);
- $where = "($table.guid = e.guid AND ($likes_str))";
+ //$where = "($table.guid = e.guid AND ($likes_str))";
+ $where = "($likes_str))";
} else {
// if using advanced or paired "s, switch into boolean mode
if ((isset($params['advanced_search']) && $params['advanced_search']) || substr_count($query, '"') >= 2 ) {
@@ -338,11 +342,12 @@ function search_get_where_sql($table, $fields, $params) {
// if short query, use query expansion.
if (strlen($query) < 6) {
- $options .= ' WITH QUERY EXPANSION';
+ //$options .= ' WITH QUERY EXPANSION';
}
// if query is shorter than the ft_min_word_len switch to literal mode.
$fields_str = implode(',', $fields);
- $where = "($table.guid = e.guid AND (MATCH ($fields_str) AGAINST ('$query' $options)))";
+ //$where = "($table.guid = e.guid AND (MATCH ($fields_str) AGAINST ('$query' $options)))";
+ $where = "(MATCH ($fields_str) AGAINST ('$query' $options))";
}
return $where;