aboutsummaryrefslogtreecommitdiff
path: root/mod/search/start.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-09 20:44:34 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-09 20:44:34 +0000
commit867c8c94a1bed4bc862bc22f05922a5d9492b401 (patch)
tree119a91d5ba0276e0be3ce1c627b28ebe124144c0 /mod/search/start.php
parentf803e43dbb0d81c29ad47ddab850cd4a637eb975 (diff)
downloadelgg-867c8c94a1bed4bc862bc22f05922a5d9492b401.tar.gz
elgg-867c8c94a1bed4bc862bc22f05922a5d9492b401.tar.bz2
Updated search to allow filtering of results by clicking on submenu items.
Fixes #1358: Using raw mysql_query() / fetch() to get ft_min/max vars since they aren't set on some versions of MySQL. git-svn-id: http://code.elgg.org/elgg/trunk@3645 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/search/start.php')
-rw-r--r--mod/search/start.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/mod/search/start.php b/mod/search/start.php
index cad2aab41..02f7da494 100644
--- a/mod/search/start.php
+++ b/mod/search/start.php
@@ -35,11 +35,19 @@ function search_init() {
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');
-
$CONFIG->search_info = array();
- $CONFIG->search_info['min_chars'] = $word_lens[0]->min;
- $CONFIG->search_info['max_chars'] = $word_lens[0]->max;
+
+ // can't use get_data() here because some servers don't have these globals set,
+ // which throws a db exception.
+ $r = mysql_query('SELECT @@ft_min_word_len as min, @@ft_max_word_len as max');
+ if ($word_lens = mysql_fetch_assoc($r)) {
+ $CONFIG->search_info['min_chars'] = $word_lens['min'];
+ $CONFIG->search_info['max_chars'] = $word_lens['max'];
+ } else {
+ // uhhh these are good numbers.
+ $CONFIG->search_info['min_chars'] = 4;
+ $CONFIG->search_info['max_chars'] = 90;
+ }
// add in CSS for search elements
extend_view('css', 'search/css');
@@ -331,7 +339,7 @@ function search_get_where_sql($table, $fields, $params) {
}
$likes_str = implode(' OR ', $likes);
//$where = "($table.guid = e.guid AND ($likes_str))";
- $where = "($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 ) {