Index: trunk/kernel/units/general/helpers/search_helper.php =================================================================== diff -u -N -r4225 -r4228 --- trunk/kernel/units/general/helpers/search_helper.php (.../search_helper.php) (revision 4225) +++ trunk/kernel/units/general/helpers/search_helper.php (.../search_helper.php) (revision 4228) @@ -12,17 +12,76 @@ function splitKeyword($keyword) { $quotes_re = '/([+\-]?)"(.*?)"/'; - $no_qutes_re = '/([+\-]?)([^ ]+)/'; + $no_quotes_re = '/([+\-]?)([^ ]+)/'; $quoted_kw = preg_match_all($quotes_re, $keyword, $res); foreach ($res[2] as $index => $kw) $final[$kw] = $res[1][$index]; $keyword = preg_replace($quotes_re, '', $keyword); - $not_quoted_kw = preg_match_all($no_qutes_re, $keyword, $res); + $not_quoted_kw = preg_match_all($no_quotes_re, $keyword, $res); foreach ($res[2] as $index => $kw) $final[$kw] = $res[1][$index]; return $final; } + function getPositiveKeywords($keyword) + { + $keywords = $this->splitKeyword($keyword); + + $ret = Array(); + foreach ($keywords as $keyword => $sign) { + if ($sign == '+' || $sign == '') { + $ret[] = $keyword; + } + } + return $ret; + } + + function buildWhereClause($keyword, $fields) + { + $keywords = $this->splitKeyword($keyword); + + $normal_conditions = Array(); + $plus_conditions = Array(); + $minus_conditions = Array(); + + foreach ($keywords as $keyword => $sign) { + switch ($sign) { + case '+': + $plus_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $fields).' LIKE "%'.$keyword.'%"'; + break; + + case '-': + foreach ($fields as $field) { + $condition[] = $field.' NOT LIKE "%'.$keyword.'%" OR '.$field.' IS NULL'; + } + $minus_conditions[] = '('.implode(') AND (', $condition).')'; + break; + + case '': + $normal_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $fields).' LIKE "%'.$keyword.'%"'; + break; + } + } + + // building where clause + if ($normal_conditions) { + $where_clause = '('.implode(') OR (', $normal_conditions).')'; + } + else { + $where_clause = '1'; + } + + if ($plus_conditions) { + $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $plus_conditions).')'; + } + + if ($minus_conditions) { + $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $minus_conditions).')'; + } + + return $where_clause; + } + } ?> \ No newline at end of file Index: trunk/kernel/units/general/cat_event_handler.php =================================================================== diff -u -N -r4216 -r4228 --- trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4216) +++ trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4228) @@ -667,12 +667,14 @@ $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$product_table.'.ResourceId = custom_data.ResourceId'; } - foreach($field_list as $key => $field) - { + // what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table)) + $search_config_map = Array(); + + foreach ($field_list as $key => $field) { $options = $object->getFieldOptions($field); $local_table = TABLE_PREFIX.$search_config[$field]['TableName']; $weight_sum += $search_config[$field]['Priority']; // counting weight sum; used when making relevance clause - + // processing multilingual fields if (getArrayValue($options, 'formatter') == 'kMultiLanguage') { $field_list[$key] = 'l'.$lang.'_'.$field; @@ -704,8 +706,10 @@ $alias_counter++; $alias = 't'.$alias_counter; - + $field_list[$key] = $alias.'.'.$exploded[1]; + $search_config_map[ $field_list[$key] ] = $field; + $join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']); $join_clause = str_replace('{LocalTable}', $product_table, $join_clause); @@ -720,115 +724,14 @@ $field_list[$key] = 'l'.$lang.'_cust_'.array_search($field_list[$key], $custom_fields); } $field_list[$key] = $local_table.'.'.$field_list[$key]; + $search_config_map[ $field_list[$key] ] = $field; } } // keyword string processing - $normal_keywords = Array(); - $plus_keywords = Array(); - $minus_keywords = Array(); - - for($i = 0; $i < strlen($keywords); $i++) - { - if(substr($keywords, $i, 1) == ' ') continue; - $extra_skip = 0; - switch(substr($keywords, $i, 1)) - { - case '+': - if(substr($keywords, $i + 1, 1) == '"') - { - $keyword_start = $i + 2; - $keyword_end = strpos($keywords, '"', $i + 2); - $extra_skip = 2; - } - else - { - $keyword_start = $i + 1; - $keyword_end = strpos($keywords, ' ', $i + 1); - $extra_skip = 0; - } - $target_array =& $plus_keywords; - break; - case '-': - if(substr($keywords, $i + 1, 1) == '"') - { - $keyword_start = $i + 2; - $keyword_end = strpos($keywords, '"', $i + 2); - $extra_skip = 2; - } - else - { - $keyword_start = $i + 1; - $keyword_end = strpos($keywords, ' ', $i + 1); - $extra_skip = 0; - } - $target_array =& $minus_keywords; - break; - case '"': - $keyword_start = $i + 1; - $keyword_end = strpos($keywords, '"', $i + 1); - $extra_skip = 1; - $target_array =& $normal_keywords; - break; - default: - $keyword_start = $i; - $keyword_end = strpos($keywords, ' ', $i + 1); - $target_array =& $normal_keywords; - } - - if($keyword_end === false) - { - $keyword_end = strlen($keywords); - } - $keyword_length = $keyword_end - $keyword_start; - $keyword = substr($keywords, $keyword_start, $keyword_length); - - if(strlen($keyword) >= $this->Application->ConfigValue('Search_MinKeyword_Length')) - { - $target_array[] = addcslashes($keyword, '"'); - } - - $i += $keyword_length + $extra_skip; - } - - // preparing conditions - $normal_conditions = Array(); - $plus_conditions = Array(); - $minus_conditions = Array(); - foreach($normal_keywords as $keyword) - { - $normal_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $field_list).' LIKE "%'.$keyword.'%"'; - } - foreach($plus_keywords as $keyword) - { - $plus_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $field_list).' LIKE "%'.$keyword.'%"'; - } - foreach($minus_keywords as $keyword) - { - foreach($field_list as $field) - { - $condition[] = $field.' NOT LIKE "%'.$keyword.'%" OR '.$field.' IS NULL'; - } - $minus_conditions[] = '('.implode(') AND (', $condition).')'; - } - - // building where clause - if($normal_conditions) - { - $where_clause = '('.implode(') OR (', $normal_conditions).')'; - } - else - { - $where_clause = '1'; - } - if($plus_conditions) - { - $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $plus_conditions).')'; - } - if($minus_conditions) - { - $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $minus_conditions).')'; - } + $search_helper =& $this->Application->recallObject('SearchHelper'); + $where_clause = $search_helper->buildWhereClause($keywords, $field_list); + $where_clause = $where_clause.' AND '.$product_table.'.Status=1'; if($this->Application->GetVar('Action') == 'm_simple_subsearch') // subsearch, In-portal @@ -846,21 +749,16 @@ } } - // building having clause - - // making relevance clause - $positive_words = array_merge($normal_keywords, $plus_keywords); + $positive_words = $search_helper->getPositiveKeywords($keywords); $this->Application->StoreVar('highlight_keywords', serialize($positive_words)); $revelance_parts = Array(); reset($search_config); - foreach($field_list as $field) - { + foreach ($field_list as $field) { $config_elem = each($search_config); - $weight = $search_config[$field]['Priority']; + $weight = $search_config[ $search_config_map[$field] ]['Priority']; $revelance_parts[] = 'IF('.$field.' LIKE "%'.implode(' ', $positive_words).'%", '.$weight_sum.', 0)'; - foreach($positive_words as $keyword) - { + foreach ($positive_words as $keyword) { $revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$config_elem['value']['Priority'].', 0)'; } } @@ -872,17 +770,14 @@ $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; // building final search query - if( !$this->Application->GetVar('INPORTAL_ON') ) - { + if (!$this->Application->GetVar('INPORTAL_ON')) { $this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event } - if($this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"')) - { + if ($this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"')) { $select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) '; } - else - { + else { $select_intro = 'CREATE TABLE '.$search_table.' AS '; } Index: trunk/core/units/general/helpers/search_helper.php =================================================================== diff -u -N -r4225 -r4228 --- trunk/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 4225) +++ trunk/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 4228) @@ -12,17 +12,76 @@ function splitKeyword($keyword) { $quotes_re = '/([+\-]?)"(.*?)"/'; - $no_qutes_re = '/([+\-]?)([^ ]+)/'; + $no_quotes_re = '/([+\-]?)([^ ]+)/'; $quoted_kw = preg_match_all($quotes_re, $keyword, $res); foreach ($res[2] as $index => $kw) $final[$kw] = $res[1][$index]; $keyword = preg_replace($quotes_re, '', $keyword); - $not_quoted_kw = preg_match_all($no_qutes_re, $keyword, $res); + $not_quoted_kw = preg_match_all($no_quotes_re, $keyword, $res); foreach ($res[2] as $index => $kw) $final[$kw] = $res[1][$index]; return $final; } + function getPositiveKeywords($keyword) + { + $keywords = $this->splitKeyword($keyword); + + $ret = Array(); + foreach ($keywords as $keyword => $sign) { + if ($sign == '+' || $sign == '') { + $ret[] = $keyword; + } + } + return $ret; + } + + function buildWhereClause($keyword, $fields) + { + $keywords = $this->splitKeyword($keyword); + + $normal_conditions = Array(); + $plus_conditions = Array(); + $minus_conditions = Array(); + + foreach ($keywords as $keyword => $sign) { + switch ($sign) { + case '+': + $plus_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $fields).' LIKE "%'.$keyword.'%"'; + break; + + case '-': + foreach ($fields as $field) { + $condition[] = $field.' NOT LIKE "%'.$keyword.'%" OR '.$field.' IS NULL'; + } + $minus_conditions[] = '('.implode(') AND (', $condition).')'; + break; + + case '': + $normal_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $fields).' LIKE "%'.$keyword.'%"'; + break; + } + } + + // building where clause + if ($normal_conditions) { + $where_clause = '('.implode(') OR (', $normal_conditions).')'; + } + else { + $where_clause = '1'; + } + + if ($plus_conditions) { + $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $plus_conditions).')'; + } + + if ($minus_conditions) { + $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $minus_conditions).')'; + } + + return $where_clause; + } + } ?> \ No newline at end of file Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r4216 -r4228 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4216) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4228) @@ -667,12 +667,14 @@ $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$product_table.'.ResourceId = custom_data.ResourceId'; } - foreach($field_list as $key => $field) - { + // what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table)) + $search_config_map = Array(); + + foreach ($field_list as $key => $field) { $options = $object->getFieldOptions($field); $local_table = TABLE_PREFIX.$search_config[$field]['TableName']; $weight_sum += $search_config[$field]['Priority']; // counting weight sum; used when making relevance clause - + // processing multilingual fields if (getArrayValue($options, 'formatter') == 'kMultiLanguage') { $field_list[$key] = 'l'.$lang.'_'.$field; @@ -704,8 +706,10 @@ $alias_counter++; $alias = 't'.$alias_counter; - + $field_list[$key] = $alias.'.'.$exploded[1]; + $search_config_map[ $field_list[$key] ] = $field; + $join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']); $join_clause = str_replace('{LocalTable}', $product_table, $join_clause); @@ -720,115 +724,14 @@ $field_list[$key] = 'l'.$lang.'_cust_'.array_search($field_list[$key], $custom_fields); } $field_list[$key] = $local_table.'.'.$field_list[$key]; + $search_config_map[ $field_list[$key] ] = $field; } } // keyword string processing - $normal_keywords = Array(); - $plus_keywords = Array(); - $minus_keywords = Array(); - - for($i = 0; $i < strlen($keywords); $i++) - { - if(substr($keywords, $i, 1) == ' ') continue; - $extra_skip = 0; - switch(substr($keywords, $i, 1)) - { - case '+': - if(substr($keywords, $i + 1, 1) == '"') - { - $keyword_start = $i + 2; - $keyword_end = strpos($keywords, '"', $i + 2); - $extra_skip = 2; - } - else - { - $keyword_start = $i + 1; - $keyword_end = strpos($keywords, ' ', $i + 1); - $extra_skip = 0; - } - $target_array =& $plus_keywords; - break; - case '-': - if(substr($keywords, $i + 1, 1) == '"') - { - $keyword_start = $i + 2; - $keyword_end = strpos($keywords, '"', $i + 2); - $extra_skip = 2; - } - else - { - $keyword_start = $i + 1; - $keyword_end = strpos($keywords, ' ', $i + 1); - $extra_skip = 0; - } - $target_array =& $minus_keywords; - break; - case '"': - $keyword_start = $i + 1; - $keyword_end = strpos($keywords, '"', $i + 1); - $extra_skip = 1; - $target_array =& $normal_keywords; - break; - default: - $keyword_start = $i; - $keyword_end = strpos($keywords, ' ', $i + 1); - $target_array =& $normal_keywords; - } - - if($keyword_end === false) - { - $keyword_end = strlen($keywords); - } - $keyword_length = $keyword_end - $keyword_start; - $keyword = substr($keywords, $keyword_start, $keyword_length); - - if(strlen($keyword) >= $this->Application->ConfigValue('Search_MinKeyword_Length')) - { - $target_array[] = addcslashes($keyword, '"'); - } - - $i += $keyword_length + $extra_skip; - } - - // preparing conditions - $normal_conditions = Array(); - $plus_conditions = Array(); - $minus_conditions = Array(); - foreach($normal_keywords as $keyword) - { - $normal_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $field_list).' LIKE "%'.$keyword.'%"'; - } - foreach($plus_keywords as $keyword) - { - $plus_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $field_list).' LIKE "%'.$keyword.'%"'; - } - foreach($minus_keywords as $keyword) - { - foreach($field_list as $field) - { - $condition[] = $field.' NOT LIKE "%'.$keyword.'%" OR '.$field.' IS NULL'; - } - $minus_conditions[] = '('.implode(') AND (', $condition).')'; - } - - // building where clause - if($normal_conditions) - { - $where_clause = '('.implode(') OR (', $normal_conditions).')'; - } - else - { - $where_clause = '1'; - } - if($plus_conditions) - { - $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $plus_conditions).')'; - } - if($minus_conditions) - { - $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $minus_conditions).')'; - } + $search_helper =& $this->Application->recallObject('SearchHelper'); + $where_clause = $search_helper->buildWhereClause($keywords, $field_list); + $where_clause = $where_clause.' AND '.$product_table.'.Status=1'; if($this->Application->GetVar('Action') == 'm_simple_subsearch') // subsearch, In-portal @@ -846,21 +749,16 @@ } } - // building having clause - - // making relevance clause - $positive_words = array_merge($normal_keywords, $plus_keywords); + $positive_words = $search_helper->getPositiveKeywords($keywords); $this->Application->StoreVar('highlight_keywords', serialize($positive_words)); $revelance_parts = Array(); reset($search_config); - foreach($field_list as $field) - { + foreach ($field_list as $field) { $config_elem = each($search_config); - $weight = $search_config[$field]['Priority']; + $weight = $search_config[ $search_config_map[$field] ]['Priority']; $revelance_parts[] = 'IF('.$field.' LIKE "%'.implode(' ', $positive_words).'%", '.$weight_sum.', 0)'; - foreach($positive_words as $keyword) - { + foreach ($positive_words as $keyword) { $revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$config_elem['value']['Priority'].', 0)'; } } @@ -872,17 +770,14 @@ $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; // building final search query - if( !$this->Application->GetVar('INPORTAL_ON') ) - { + if (!$this->Application->GetVar('INPORTAL_ON')) { $this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event } - if($this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"')) - { + if ($this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"')) { $select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) '; } - else - { + else { $select_intro = 'CREATE TABLE '.$search_table.' AS '; } Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r4216 -r4228 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4216) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4228) @@ -1308,36 +1308,32 @@ $event->setPseudoClass('_List'); $object =& $event->getObject(); - $keyword = $this->Application->GetVar( $event->getPrefixSpecial(true).'_search_keyword'); - $this->Application->StoreVar( $event->getPrefixSpecial().'_search_keyword', $keyword); - + $search_keyword = $this->Application->GetVar( $event->getPrefixSpecial(true).'_search_keyword'); + $this->Application->StoreVar( $event->getPrefixSpecial().'_search_keyword', $search_keyword); + $search_keyword = str_replace('*', '%', $search_keyword); + $custom_filters = $this->Application->RecallVar( $event->getPrefixSpecial().'_custom_filters'); $custom_filters = $custom_filters ? unserialize($custom_filters) : Array(); $submit_custom_filters = $this->Application->GetVar('custom_filters'); - if($submit_custom_filters) - { + if ($submit_custom_filters) { $submit_custom_filters = getArrayValue($submit_custom_filters, $event->getPrefixSpecial() ); - if($submit_custom_filters) - { - foreach($submit_custom_filters as $cf_name => $cf_value) - { - if($cf_value) - { + if ($submit_custom_filters) { + foreach ($submit_custom_filters as $cf_name => $cf_value) { + if ($cf_value) { $custom_filters[$cf_name] = $cf_value; } - else - { + else { unset($custom_filters[$cf_name]); } } } } $this->Application->StoreVar($event->getPrefixSpecial().'_custom_filters', serialize($custom_filters) ); - if( !$keyword && !count($custom_filters) ) + if( !$search_keyword && !count($custom_filters) ) { $this->OnSearchReset($event); return true; @@ -1348,14 +1344,14 @@ $search_fields = array_keys($grids[$grid_name]['Fields']); $search_filter = Array(); - + $search_helper =& $this->Application->recallObject('SearchHelper'); + $search_keywords = $search_helper->splitKeyword($search_keyword); + foreach($search_fields as $search_field) { $filter_type = isset($object->VirtualFields[$search_field]) ? 'having' : 'where'; $field_type = getArrayValue($object->Fields[$search_field],'type'); if(!$field_type) $field_type = 'string'; // default LIKE filter for all fields without type - $keyword = trim($keyword); - $keyword = str_replace(Array('"',"'"),'',$keyword); $filter_value = ''; $table_name = ($filter_type == 'where') ? '`'.$object->TableName.'`.' : ''; @@ -1369,23 +1365,33 @@ $field_value = getArrayValue($custom_filters, $search_field); if ($field_value !== false) { + // if keyword passed through advanced search filter (e.g. on Visits lists section) array_push($search_keys, $this->Conn->qstr($field_value)); } else { + // if keywords passed through simple search filter (on each grid) $use_phrases = getArrayValue($object->Fields[$search_field], 'use_phrases'); foreach($object->Fields[$search_field]['options'] as $key => $val) { - $pattern = '#'.$keyword.'#i'; - if ( preg_match($pattern, $use_phrases ? $this->Application->Phrase($val) : $val) ) { - array_push($search_keys, $this->Conn->qstr($key)); + foreach ($search_keywords as $keyword => $sign) { + $pattern = '#'.$keyword.'#i'; + if (!preg_match($pattern, $use_phrases ? $this->Application->Phrase($val) : $val)) continue; + + if ($sign == '+' || $sign == '') { + $search_keys[$key] = $this->Conn->qstr($key); + } + elseif($sign == '-') { + // if same value if found as exclusive too, then remove from search result + unset($search_keys[$key]); + } } } } - if (count($search_keys) > 0) { + if ($search_keys) { $filter_value = $table_name.'`'.$search_field.'` IN ('.implode(',', $search_keys).')'; } - + $field_processed = true; break; @@ -1425,44 +1431,47 @@ // if not already processed by formatter, then get clause by field type - if(!$field_processed && $keyword) - { + if (!$field_processed && $search_keywords) { switch($field_type) { case 'int': case 'integer': case 'numeric': - if( !is_numeric($keyword) ) break; - $filter_value = $table_name.'`'.$search_field.'` = \''.$keyword.'\''; + $search_keys = Array(); + foreach ($search_keywords as $keyword => $sign) { + if (!is_numeric($keyword) || ($sign == '-')) continue; + $search_keys[] = $this->Conn->qstr($keyword); + } + + if ($search_keys) { + $filter_value = $table_name.'`'.$search_field.'` IN ('.implode(',', $search_keys).')'; + } break; case 'double': case 'float': case 'real': - if( !is_numeric($keyword) ) break; - $filter_value = 'ABS('.$table_name.'`'.$search_field.'` - \''.str_replace(',','.',$keyword).'\') <= 0.0001'; + $search_keys = Array(); + foreach ($search_keywords as $keyword => $sign) { + $keyword = str_replace(',', '.', $keyword); + if (!is_numeric($keyword) || ($sign == '-')) continue; + $search_keys[] = 'ABS('.$table_name.'`'.$search_field.'` - '.$this->Conn->qstr($keyword).') <= 0.0001'; + } + + if ($search_keys) { + $filter_value = '('.implode(') OR (', $search_keys).')'; + } break; case 'string': - $like_keyword = preg_replace( '/\'(.*)\'/U', '\\1', $this->Conn->qstr( str_replace('\\','\\\\', $keyword) ) ); - $keywords = explode(' ', $like_keyword); - foreach($keywords as $keyword_pos => $keyword_value) - { - $keyword_value = trim($keyword_value); - if($keyword_value) - { - $keywords[$keyword_pos] = $table_name.'`'.$search_field.'` LIKE \'%'.$keyword_value.'%\''; - } - else - { - unset($keywords[$keyword_pos]); - } - } - $filter_value = '('.implode(') OR (',$keywords).')'; + $filter_value = $search_helper->buildWhereClause($search_keyword, Array($table_name.'`'.$search_field.'`')); break; } } - if($filter_value) $search_filter[$search_field] = Array('type' => $filter_type, 'value' => $filter_value); + + if ($filter_value) { + $search_filter[$search_field] = Array('type' => $filter_type, 'value' => $filter_value); + } } $this->Application->StoreVar($event->getPrefixSpecial().'_search_filter', serialize($search_filter) ); Index: trunk/core/units/general/my_application.php =================================================================== diff -u -N -r4000 -r4228 --- trunk/core/units/general/my_application.php (.../my_application.php) (revision 4000) +++ trunk/core/units/general/my_application.php (.../my_application.php) (revision 4228) @@ -25,7 +25,7 @@ $this->registerClass('kBracketsHelper',MODULES_PATH.'/kernel/units/general/brackets.php','BracketsHelper'); $this->registerClass('kXMLHelper',MODULES_PATH.'/kernel/units/general/xml_helper.php','kXMLHelper'); $this->registerClass('kMultiLanguageHelper',MODULES_PATH.'/kernel/units/general/helpers/multilanguage.php','kMultiLanguageHelper'); - + $this->registerClass('kSearchHelper', MODULES_PATH.'/kernel/units/general/helpers/search_helper.php', 'SearchHelper'); } function getUserGroups($user_id) Index: trunk/kernel/units/general/my_application.php =================================================================== diff -u -N -r4000 -r4228 --- trunk/kernel/units/general/my_application.php (.../my_application.php) (revision 4000) +++ trunk/kernel/units/general/my_application.php (.../my_application.php) (revision 4228) @@ -25,7 +25,7 @@ $this->registerClass('kBracketsHelper',MODULES_PATH.'/kernel/units/general/brackets.php','BracketsHelper'); $this->registerClass('kXMLHelper',MODULES_PATH.'/kernel/units/general/xml_helper.php','kXMLHelper'); $this->registerClass('kMultiLanguageHelper',MODULES_PATH.'/kernel/units/general/helpers/multilanguage.php','kMultiLanguageHelper'); - + $this->registerClass('kSearchHelper', MODULES_PATH.'/kernel/units/general/helpers/search_helper.php', 'SearchHelper'); } function getUserGroups($user_id)