Commit b66c016f authored by unknown's avatar unknown

make a clear distinction between max_word_length in *characters* and in *bytes*

parent cebe1c0e
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
extern "C" { extern "C" {
#endif #endif
#define FT_QUERY_MAXLEN 1024 #define HA_FT_MAXBYTELEN 254
#define HA_FT_MAXLEN 254 #define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN/3)
typedef struct st_ft_info FT_INFO; typedef struct st_ft_info FT_INFO;
struct _ft_vft struct _ft_vft
......
...@@ -29,7 +29,7 @@ static my_bool verbose; ...@@ -29,7 +29,7 @@ static my_bool verbose;
static char *query=NULL; static char *query=NULL;
static uint lengths[256]; static uint lengths[256];
#define MAX_LEN (HA_FT_MAXLEN+10) #define MAX_LEN (HA_FT_MAXBYTELEN+10)
#define HOW_OFTEN_TO_WRITE 10000 #define HOW_OFTEN_TO_WRITE 10000
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "ftdefs.h" #include "ftdefs.h"
ulong ft_min_word_len=4; ulong ft_min_word_len=4;
ulong ft_max_word_len=HA_FT_MAXLEN; ulong ft_max_word_len=HA_FT_MAXCHARLEN;
ulong ft_query_expansion_limit=5; ulong ft_query_expansion_limit=5;
const char *ft_boolean_syntax="+ -><()~*:\"\"&|"; const char *ft_boolean_syntax="+ -><()~*:\"\"&|";
...@@ -29,7 +29,7 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={ ...@@ -29,7 +29,7 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={
63, /* language (will be overwritten) */ 63, /* language (will be overwritten) */
0, 0, 0, /* null_bit, bit_start, bit_end */ 0, 0, 0, /* null_bit, bit_start, bit_end */
HA_VAR_LENGTH | HA_PACK_KEY, /* flag */ HA_VAR_LENGTH | HA_PACK_KEY, /* flag */
HA_FT_MAXLEN, /* length */ HA_FT_MAXBYTELEN, /* length */
HA_FT_WLEN, /* start */ HA_FT_WLEN, /* start */
0, /* null_pos */ 0, /* null_pos */
NULL /* charset */ NULL /* charset */
......
...@@ -279,7 +279,7 @@ int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, ...@@ -279,7 +279,7 @@ int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr, uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr,
my_off_t filepos) my_off_t filepos)
{ {
byte buf[HA_FT_MAXLEN+16]; byte buf[HA_FT_MAXBYTELEN+16];
DBUG_ENTER("_ft_make_key"); DBUG_ENTER("_ft_make_key");
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
......
...@@ -1979,7 +1979,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, ...@@ -1979,7 +1979,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
sort_param.key_read=sort_ft_key_read; sort_param.key_read=sort_ft_key_read;
sort_param.key_write=sort_ft_key_write; sort_param.key_write=sort_ft_key_write;
sort_param.key_length+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXLEN; sort_param.key_length+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXBYTELEN;
} }
else else
{ {
...@@ -2375,7 +2375,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, ...@@ -2375,7 +2375,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
total_key_length+=sort_param[i].key_length; total_key_length+=sort_param[i].key_length;
if (sort_param[i].keyinfo->flag & HA_FULLTEXT) if (sort_param[i].keyinfo->flag & HA_FULLTEXT)
sort_param[i].key_length+=FT_MAX_WORD_LEN_FOR_SORT-ft_max_word_len; sort_param[i].key_length+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXBYTELEN;
} }
sort_info.total_keys=i; sort_info.total_keys=i;
sort_param[0].master= 1; sort_param[0].master= 1;
...@@ -3913,7 +3913,7 @@ static my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows) ...@@ -3913,7 +3913,7 @@ static my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows)
{ {
uint key_maxlength=key->maxlength; uint key_maxlength=key->maxlength;
if (key->flag & HA_FULLTEXT) if (key->flag & HA_FULLTEXT)
key_maxlength+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXLEN; key_maxlength+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXBYTELEN;
return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) && return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
((ulonglong) rows * key_maxlength > ((ulonglong) rows * key_maxlength >
(ulonglong) myisam_max_temp_length)); (ulonglong) myisam_max_temp_length));
......
...@@ -289,9 +289,9 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -289,9 +289,9 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
} }
fulltext_keys++; fulltext_keys++;
key_length+= HA_FT_MAXLEN+HA_FT_WLEN; key_length+= HA_FT_MAXBYTELEN+HA_FT_WLEN;
length++; /* At least one length byte */ length++; /* At least one length byte */
min_key_length_skipp+=HA_FT_MAXLEN; min_key_length_skipp+=HA_FT_MAXBYTELEN;
} }
else else
{ {
......
...@@ -322,11 +322,11 @@ static struct my_option my_long_options[] = ...@@ -322,11 +322,11 @@ static struct my_option my_long_options[] =
{ "decode_bits", OPT_DECODE_BITS, "", (gptr*) &decode_bits, { "decode_bits", OPT_DECODE_BITS, "", (gptr*) &decode_bits,
(gptr*) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0}, (gptr*) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (gptr*) &ft_min_word_len, { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (gptr*) &ft_min_word_len,
(gptr*) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXLEN, (gptr*) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
0, 1, 0}, 0, 1, 0},
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len, { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len,
(gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXLEN, 10, (gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
HA_FT_MAXLEN, 0, 1, 0}, HA_FT_MAXCHARLEN, 0, 1, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
......
...@@ -156,7 +156,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, ...@@ -156,7 +156,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
while ((maxbuffer= (int) (records/(keys-1)+1)) != skr); while ((maxbuffer= (int) (records/(keys-1)+1)) != skr);
if ((sort_keys=(uchar **)my_malloc(keys*(sort_length+sizeof(char*))+ if ((sort_keys=(uchar **)my_malloc(keys*(sort_length+sizeof(char*))+
HA_FT_MAXLEN, MYF(0)))) HA_FT_MAXBYTELEN, MYF(0))))
{ {
if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer, if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer,
maxbuffer/2)) maxbuffer/2))
...@@ -365,7 +365,7 @@ pthread_handler_decl(thr_find_all_keys,arg) ...@@ -365,7 +365,7 @@ pthread_handler_decl(thr_find_all_keys,arg)
} }
if ((sort_keys=(uchar **)my_malloc(keys*(sort_length+sizeof(char*))+ if ((sort_keys=(uchar **)my_malloc(keys*(sort_length+sizeof(char*))+
((info->keyinfo->flag & HA_FULLTEXT) ? ((info->keyinfo->flag & HA_FULLTEXT) ?
HA_FT_MAXLEN : 0), MYF(0)))) HA_FT_MAXBYTELEN : 0), MYF(0))))
{ {
if (my_init_dynamic_array(&info->buffpek, sizeof(BUFFPEK), if (my_init_dynamic_array(&info->buffpek, sizeof(BUFFPEK),
maxbuffer, maxbuffer/2)) maxbuffer, maxbuffer/2))
......
...@@ -4223,11 +4223,11 @@ replicating a LOAD DATA INFILE command.", ...@@ -4223,11 +4223,11 @@ replicating a LOAD DATA INFILE command.",
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN, { "ft_min_word_len", OPT_FT_MIN_WORD_LEN,
"The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.", "The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
(gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG, (gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG,
REQUIRED_ARG, 4, 1, HA_FT_MAXLEN, 0, 1, 0}, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, 0, 1, 0},
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN, { "ft_max_word_len", OPT_FT_MAX_WORD_LEN,
"The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.", "The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
(gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG, (gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG,
REQUIRED_ARG, HA_FT_MAXLEN, 10, HA_FT_MAXLEN, 0, 1, 0}, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0},
{ "ft_query_expansion_limit", OPT_FT_QUERY_EXPANSION_LIMIT, { "ft_query_expansion_limit", OPT_FT_QUERY_EXPANSION_LIMIT,
"Number of best matches to use for query expansion", "Number of best matches to use for query expansion",
(gptr*) &ft_query_expansion_limit, (gptr*) &ft_query_expansion_limit, 0, GET_ULONG, (gptr*) &ft_query_expansion_limit, (gptr*) &ft_query_expansion_limit, 0, GET_ULONG,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment