From 9b5dd186a76336fcbfb4e39dbcb1900422541f6f Mon Sep 17 00:00:00 2001 From: zhengchao Date: Fri, 3 Jun 2016 15:10:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E7=A0=81=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E5=8E=BB=E9=87=8D=E8=BF=87=E7=A8=8B=E4=B8=AD=E5=BC=95?= =?UTF-8?q?=E5=85=A5=E7=9A=84=E4=B8=8E=E8=A1=A8=E8=BE=BE=E5=BC=8F=E5=AD=90?= =?UTF-8?q?=E9=A1=B9=E4=B8=A2=E5=A4=B1=E7=9A=84bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entry/Maat_rule.cpp | 21 ++++++++++++++------- src/entry/Maat_rule_internal.h | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index aa761ce..65c5375 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_7_20160525=1; +int MAAT_FRAME_VERSION_1_8_20160603=1; const char *maat_module="MAAT Frame"; const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin", @@ -764,6 +764,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->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; @@ -1450,13 +1451,10 @@ int add_expr_rule(struct _Maat_table_info_t* table,struct db_str_rule_t* db_rule free(region_string); continue; } - //if convert take no effect and src charset is one of the dst. if(region_str_len==(int)strlen(sub_key_array[k])&& - 0==memcmp(sub_key_array[k],region_string,region_str_len)&& - TRUE==table->src_charset_in_dst) + 0==memcmp(sub_key_array[k],region_string,region_str_len)) { - free(region_string); - continue; + op_expr->no_effect_convert_cnt++;; } } else @@ -1475,7 +1473,16 @@ int add_expr_rule(struct _Maat_table_info_t* table,struct db_str_rule_t* db_rule free(region_string); region_string=NULL; } - MESA_lqueue_join_tail(scanner->region_update_q,&op_expr, sizeof(void*)); + //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) + { + destroy_op_expr(op_expr); + op_expr=NULL; + } + else + { + MESA_lqueue_join_tail(scanner->region_update_q,&op_expr, sizeof(void*)); + } } } diff --git a/src/entry/Maat_rule_internal.h b/src/entry/Maat_rule_internal.h index 65d8149..81d2c78 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 no_effect_convert_cnt; }; struct _Maat_region_rule_t