diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 56aba1c..560f6aa 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -4644,6 +4644,9 @@ fts_add_token( fts_string_t str, ulint position) { + const char* bin_suffix = "%bin"; + const char* cs_suffix = "%cs"; + /* Ignore string whose character number is less than "fts_min_token_size" or more than "fts_max_token_size" */ @@ -4665,10 +4668,28 @@ fts_add_token( t_str.f_str = static_cast( mem_heap_alloc(heap, t_str.f_len)); - newlen = innobase_fts_casedn_str( - result_doc->charset, - reinterpret_cast(str.f_str), str.f_len, - reinterpret_cast(t_str.f_str), t_str.f_len); + if (my_wildcmp(result_doc->charset, result_doc->charset->name, + (const char*) (result_doc->charset->name + strlen(result_doc->charset->name)), + bin_suffix, (const char*) (bin_suffix + strlen(bin_suffix)), + '\\', '_', '%') + || + my_wildcmp(result_doc->charset, result_doc->charset->name, + (const char*) (result_doc->charset->name + strlen(result_doc->charset->name)), + cs_suffix, (const char*) (cs_suffix + strlen(bin_suffix)), + '\\', '_', '%') + ) + { + memcpy(t_str.f_str, str.f_str, str.f_len); + t_str.f_str[str.f_len]= 0; + newlen= str.f_len; + } + else + { + newlen = innobase_fts_casedn_str( + result_doc->charset, + reinterpret_cast(str.f_str), str.f_len, + reinterpret_cast(t_str.f_str), t_str.f_len); + } t_str.f_len = newlen; t_str.f_str[newlen] = 0; diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index ee25b41..e5e6794 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -3972,6 +3972,9 @@ fts_query( ulint start_time_ms; bool will_be_ignored = false; + const char* bin_suffix = "%bin"; + const char* cs_suffix = "%cs"; + boolean_mode = flags & FTS_BOOL; *result = NULL; @@ -4057,9 +4060,25 @@ fts_query( lc_query_str_len = query_len * charset->casedn_multiply + 1; lc_query_str = static_cast(ut_malloc_nokey(lc_query_str_len)); - result_len = innobase_fts_casedn_str( - charset, (char*) query_str, query_len, - (char*) lc_query_str, lc_query_str_len); + if (my_wildcmp(charset, charset->name, (const char*) (charset->name + strlen(charset->name)), + bin_suffix, (const char*) (bin_suffix + strlen(bin_suffix)), + '\\', '_', '%') + || + my_wildcmp(charset, charset->name, (const char*) (charset->name + strlen(charset->name)), + cs_suffix, (const char*) (cs_suffix + strlen(bin_suffix)), + '\\', '_', '%') + ) + { + memcpy(lc_query_str, query_str, query_len); + lc_query_str[query_len]= 0; + result_len= query_len; + } + else + { + result_len = innobase_fts_casedn_str( + charset, (char*) query_str, query_len, + (char*) lc_query_str, lc_query_str_len); + } ut_ad(result_len < lc_query_str_len);