diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index 8bc5366..4c557fa 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -26,7 +26,7 @@ #include "mesa_fuzzy.h" #include "great_index_engine.h" -int MAAT_FRAME_VERSION_1_8_20160623_PERF_TEST=1; +int MAAT_FRAME_VERSION_1_8_20160624_PERF_TEST=1; const char *maat_module="MAAT Frame"; const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin", @@ -810,6 +810,7 @@ struct op_expr_t* create_op_expr(unsigned int expr_id,int operation,void* u_para struct op_expr_t* op_expr=NULL; op_expr=(struct op_expr_t*)calloc(sizeof(struct op_expr_t),1); op_expr->no_effect_convert_cnt=0; + op_expr->convert_failed=0; op_expr->p_expr=(boolean_expr_t*)calloc(sizeof(boolean_expr_t),1); op_expr->p_expr->expr_id=expr_id; op_expr->p_expr->operation=operation; @@ -1536,7 +1537,8 @@ int add_expr_rule(struct _Maat_table_info_t* table,struct db_str_rule_t* db_rule ,CHARSET_STRING[table->src_charset] ,CHARSET_STRING[dst_charset]); free(region_string); - continue; + op_expr->convert_failed++; + break; } if(region_str_len==(int)strlen(sub_key_array[k])&& 0==memcmp(sub_key_array[k],region_string,region_str_len)) @@ -1561,7 +1563,9 @@ int add_expr_rule(struct _Maat_table_info_t* table,struct db_str_rule_t* db_rule region_string=NULL; } //if each sub string's convert take no effect and src charset is one of the dst. - if(TRUE==table->src_charset_in_dst&&op_expr->no_effect_convert_cnt==sub_expr_cnt) + //if any sub expr convert failed + if((TRUE==table->src_charset_in_dst&&op_expr->no_effect_convert_cnt==sub_expr_cnt)|| + op_expr->convert_failed>0) { destroy_op_expr(op_expr); op_expr=NULL; diff --git a/src/entry/Maat_rule_internal.h b/src/entry/Maat_rule_internal.h index 2efa83e..b8ad00d 100644 --- a/src/entry/Maat_rule_internal.h +++ b/src/entry/Maat_rule_internal.h @@ -167,6 +167,7 @@ struct op_expr_t { boolean_expr_t* p_expr; scan_rule_t* p_rules[MAAT_MAX_EXPR_ITEM_NUM]; + int convert_failed; int no_effect_convert_cnt; };