Fixes after comments from last push:
- Removed some not needed casts - Change plugin.h to be 'binary compatible' with old versions - Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change - Made some fixes suggested by Kristian to make things more portable and future safe (when it comes to strict aliasing) include/ft_global.h: Introduced FT_WEIGTH, to handle fulltext weights in a slightly more portable manner include/mysql/plugin.h: Change plugin.h to be 'binary compatible' with old versions Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change Changed flags to unsigned (as flags should always be unsigned) mysql-test/t/information_schema.test: Fixed typo sql/sp_head.cc: Removed cast sql/sql_select.cc: Removed cast sql/table.cc: Removed cast storage/maria/ma_ft_boolean_search.c: Use mysql_ft_size_t instead of size_t for plugin.h code Changed some other string lengths to size_t storage/maria/ma_ft_nlq_search.c: Use FT_WEIGTH to make code more portable storage/maria/ma_ft_parser.c: Use mysql_ft_size_t instead of size_t for plugin.h code Changed some other string lengths to size_t storage/maria/ma_ftdefs.h: Changed some string lengths to size_t storage/maria/maria_ftdump.c: Use FT_WEIGTH to make code more portable storage/myisam/ft_boolean_search.c: Use mysql_ft_size_t instead of size_t for plugin.h code storage/myisam/ft_nlq_search.c: Use FT_WEIGTH to make code more portable storage/myisam/ft_parser.c: Use mysql_ft_size_t instead of size_t for plugin.h code storage/myisam/myisam_ftdump.c: Use FT_WEIGTH to make code more portable
This commit is contained in:
parent
5d9c3014ce
commit
0df8279c46
@ -76,6 +76,8 @@ my_bool ft_boolean_check_syntax_string(const uchar *);
|
||||
|
||||
extern const HA_KEYSEG ft_keysegs[FT_SEGS];
|
||||
|
||||
typedef union {int32 i; float f;} FT_WEIGTH;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -564,19 +564,22 @@ typedef struct st_mysql_ftparser_boolean_info
|
||||
nothing. See enum_ftparser_mode above.
|
||||
*/
|
||||
|
||||
/* TODO: Change the following int to size_t at next ABI update */
|
||||
typedef int mysql_ft_size_t;
|
||||
|
||||
typedef struct st_mysql_ftparser_param
|
||||
{
|
||||
int (*mysql_parse)(struct st_mysql_ftparser_param *,
|
||||
const unsigned char *doc, size_t doc_len);
|
||||
const unsigned char *doc, mysql_ft_size_t doc_len);
|
||||
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
|
||||
const unsigned char *word, size_t word_len,
|
||||
const unsigned char *word, mysql_ft_size_t word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
|
||||
void *ftparser_state;
|
||||
void *mysql_ftparam;
|
||||
struct charset_info_st *cs;
|
||||
char *doc;
|
||||
int length;
|
||||
int flags;
|
||||
const unsigned char *doc;
|
||||
mysql_ft_size_t length;
|
||||
unsigned int flags;
|
||||
enum enum_ftparser_mode mode;
|
||||
} MYSQL_FTPARSER_PARAM;
|
||||
|
||||
|
@ -70,19 +70,20 @@ typedef struct st_mysql_ftparser_boolean_info
|
||||
char prev;
|
||||
char *quot;
|
||||
} MYSQL_FTPARSER_BOOLEAN_INFO;
|
||||
typedef int mysql_ft_size_t;
|
||||
typedef struct st_mysql_ftparser_param
|
||||
{
|
||||
int (*mysql_parse)(struct st_mysql_ftparser_param *,
|
||||
const unsigned char *doc, size_t doc_len);
|
||||
const unsigned char *doc, mysql_ft_size_t doc_len);
|
||||
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
|
||||
const unsigned char *word, size_t word_len,
|
||||
const unsigned char *word, mysql_ft_size_t word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
|
||||
void *ftparser_state;
|
||||
void *mysql_ftparam;
|
||||
struct charset_info_st *cs;
|
||||
char *doc;
|
||||
int length;
|
||||
int flags;
|
||||
const unsigned char *doc;
|
||||
mysql_ft_size_t length;
|
||||
unsigned int flags;
|
||||
enum enum_ftparser_mode mode;
|
||||
} MYSQL_FTPARSER_PARAM;
|
||||
struct st_mysql_ftparser
|
||||
|
@ -5,7 +5,7 @@
|
||||
# on the presence of the log tables (which are CSV-based).
|
||||
--source include/have_csv.inc
|
||||
|
||||
# Check that innodb/xtradb is incompiled in as result depends on it
|
||||
# Check that InnoDB/XtraDB was compiled in as result depends on it
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
# Save the initial number of concurrent sessions
|
||||
|
@ -1924,7 +1924,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
||||
if (spvar->mode == sp_param_out)
|
||||
{
|
||||
Item_null *null_item= new Item_null();
|
||||
Item *tmp_item= (Item*) null_item;
|
||||
Item *tmp_item= null_item;
|
||||
|
||||
if (!null_item ||
|
||||
nctx->set_variable(thd, i, &tmp_item))
|
||||
|
@ -3586,7 +3586,7 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
|
||||
{
|
||||
if (!field->eq(item->field))
|
||||
{
|
||||
Item *tmp_item= (Item*) item;
|
||||
Item *tmp_item= item;
|
||||
add_key_field(key_fields, *and_level, cond_func, field,
|
||||
TRUE, &tmp_item, 1, usable_tables,
|
||||
sargables);
|
||||
|
@ -2077,7 +2077,7 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
|
||||
else
|
||||
{
|
||||
char *str;
|
||||
const char **tmp = (const char**) (char*) buf;
|
||||
const char **tmp = (const char**) buf;
|
||||
str=(char *) (buf+a_length);
|
||||
fix_type_pointers(&tmp, save_names, 1, &str);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
|
||||
|
||||
|
||||
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *word, size_t word_len,
|
||||
const uchar *word, mysql_ft_size_t word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *info)
|
||||
{
|
||||
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
|
||||
@ -282,7 +282,7 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
|
||||
|
||||
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *query, size_t len)
|
||||
const uchar *query, mysql_ft_size_t len)
|
||||
{
|
||||
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO info;
|
||||
@ -299,7 +299,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
|
||||
}
|
||||
|
||||
|
||||
static int _ftb_parse_query(FTB *ftb, uchar *query, uint len,
|
||||
static int _ftb_parse_query(FTB *ftb, uchar *query, size_t len,
|
||||
struct st_mysql_ftparser *parser)
|
||||
{
|
||||
MYSQL_FTPARSER_PARAM *param;
|
||||
@ -321,7 +321,7 @@ static int _ftb_parse_query(FTB *ftb, uchar *query, uint len,
|
||||
param->mysql_add_word= ftb_query_add_word;
|
||||
param->mysql_ftparam= (void *)&ftb_param;
|
||||
param->cs= ftb->charset;
|
||||
param->doc= (char*) query;
|
||||
param->doc= query;
|
||||
param->length= len;
|
||||
param->flags= 0;
|
||||
param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO;
|
||||
@ -539,8 +539,8 @@ static void _ftb_init_index_search(FT_INFO *ftb)
|
||||
|
||||
|
||||
FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr,
|
||||
uchar *query,
|
||||
uint query_len, CHARSET_INFO *cs)
|
||||
uchar *query, size_t query_len,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
FTB *ftb;
|
||||
FTB_EXPR *ftbe;
|
||||
@ -615,8 +615,9 @@ typedef struct st_my_ftb_phrase_param
|
||||
|
||||
|
||||
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *word, size_t word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
|
||||
const uchar *word, mysql_ft_size_t word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO
|
||||
*boolean_info __attribute__((unused)))
|
||||
{
|
||||
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
|
||||
FT_WORD *w= (FT_WORD *)phrase_param->document->data;
|
||||
@ -647,7 +648,8 @@ static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
|
||||
|
||||
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *document, size_t len)
|
||||
const uchar *document,
|
||||
mysql_ft_size_t len)
|
||||
{
|
||||
FT_WORD word;
|
||||
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
|
||||
@ -678,8 +680,8 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
|
||||
-1 is returned if error occurs.
|
||||
*/
|
||||
|
||||
static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
|
||||
FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
|
||||
static int _ftb_check_phrase(FTB *ftb, const uchar *document, size_t len,
|
||||
FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
|
||||
{
|
||||
MY_FTB_PHRASE_PARAM ftb_param;
|
||||
MYSQL_FTPARSER_PARAM *param;
|
||||
@ -699,7 +701,7 @@ static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
|
||||
param->mysql_add_word= ftb_phrase_add_word;
|
||||
param->mysql_ftparam= (void *)&ftb_param;
|
||||
param->cs= ftb->charset;
|
||||
param->doc= (char *) document;
|
||||
param->doc= document;
|
||||
param->length= len;
|
||||
param->flags= 0;
|
||||
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
|
||||
@ -872,8 +874,9 @@ typedef struct st_my_ftb_find_param
|
||||
|
||||
|
||||
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *word, size_t len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
|
||||
const uchar *word, mysql_ft_size_t len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO
|
||||
*boolean_info __attribute__((unused)))
|
||||
{
|
||||
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
|
||||
FT_INFO *ftb= ftb_param->ftb;
|
||||
@ -933,7 +936,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
|
||||
|
||||
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *doc, size_t len)
|
||||
const uchar *doc, mysql_ft_size_t len)
|
||||
{
|
||||
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
|
||||
FT_INFO *ftb= ftb_param->ftb;
|
||||
@ -997,7 +1000,7 @@ float maria_ft_boolean_find_relevance(FT_INFO *ftb, uchar *record, uint length)
|
||||
{
|
||||
if (!ftsi.pos)
|
||||
continue;
|
||||
param->doc= (char *)ftsi.pos;
|
||||
param->doc= ftsi.pos;
|
||||
param->length= ftsi.len;
|
||||
if (unlikely(parser->parse(param)))
|
||||
return 0;
|
||||
|
@ -51,6 +51,7 @@ typedef struct st_ft_superdoc
|
||||
double tmp_weight;
|
||||
} FT_SUPERDOC;
|
||||
|
||||
|
||||
static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)),
|
||||
FT_SUPERDOC *p1, FT_SUPERDOC *p2)
|
||||
{
|
||||
@ -63,7 +64,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)),
|
||||
|
||||
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
{
|
||||
int32 subkeys;
|
||||
FT_WEIGTH subkeys;
|
||||
int r;
|
||||
uint doc_cnt;
|
||||
FT_SUPERDOC sdoc, *sptr;
|
||||
@ -91,9 +92,9 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
/* Skip rows inserted by current inserted */
|
||||
for (r= _ma_search(info, &key, SEARCH_FIND, key_root) ;
|
||||
!r &&
|
||||
(subkeys=ft_sintXkorr(info->last_key.data +
|
||||
info->last_key.data_length +
|
||||
info->last_key.ref_length - extra)) > 0 &&
|
||||
(subkeys.i= ft_sintXkorr(info->last_key.data +
|
||||
info->last_key.data_length +
|
||||
info->last_key.ref_length - extra)) > 0 &&
|
||||
info->cur_row.lastpos >= info->state->data_file_length ;
|
||||
r= _ma_search_next(info, &info->last_key, SEARCH_BIGGER, key_root))
|
||||
;
|
||||
@ -112,7 +113,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
key.data+1, key.data_length-1, 0, 0))
|
||||
break;
|
||||
|
||||
if (subkeys<0)
|
||||
if (subkeys.i < 0)
|
||||
{
|
||||
if (doc_cnt)
|
||||
DBUG_RETURN(1); /* index is corrupted */
|
||||
@ -128,7 +129,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
goto do_skip;
|
||||
}
|
||||
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
|
||||
tmp_weight=*(float*) (char*) &subkeys;
|
||||
/* The weight we read was actually a float */
|
||||
tmp_weight= subkeys.f;
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
@ -163,9 +165,9 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
else
|
||||
r= _ma_search(info, &info->last_key, SEARCH_BIGGER, key_root);
|
||||
do_skip:
|
||||
while ((subkeys=ft_sintXkorr(info->last_key.data +
|
||||
info->last_key.data_length +
|
||||
info->last_key.ref_length - extra)) > 0 &&
|
||||
while ((subkeys.i= ft_sintXkorr(info->last_key.data +
|
||||
info->last_key.data_length +
|
||||
info->last_key.ref_length - extra)) > 0 &&
|
||||
!r && info->cur_row.lastpos >= info->state->data_file_length)
|
||||
r= _ma_search_next(info, &info->last_key, SEARCH_BIGGER, key_root);
|
||||
|
||||
@ -206,7 +208,7 @@ static int FT_DOC_cmp(void *unused __attribute__((unused)),
|
||||
|
||||
|
||||
FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
|
||||
uint query_len, uint flags, uchar *record)
|
||||
size_t query_len, uint flags, uchar *record)
|
||||
{
|
||||
TREE wtree;
|
||||
ALL_IN_ONE aio;
|
||||
|
@ -260,7 +260,7 @@ void maria_ft_parse_init(TREE *wtree, CHARSET_INFO *cs)
|
||||
|
||||
|
||||
static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *word, size_t word_len,
|
||||
const uchar *word, mysql_ft_size_t word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
|
||||
__attribute__((unused)))
|
||||
{
|
||||
@ -290,7 +290,8 @@ static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
|
||||
|
||||
static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *doc_arg, size_t doc_len)
|
||||
const uchar *doc_arg,
|
||||
mysql_ft_size_t doc_len)
|
||||
{
|
||||
const uchar *doc= doc_arg;
|
||||
const uchar *end= doc + doc_len;
|
||||
@ -306,8 +307,8 @@ static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
|
||||
}
|
||||
|
||||
|
||||
int maria_ft_parse(TREE *wtree, uchar *doc, int doclen,
|
||||
struct st_mysql_ftparser *parser,
|
||||
int maria_ft_parse(TREE *wtree, uchar *doc, size_t doclen,
|
||||
struct st_mysql_ftparser *parser,
|
||||
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
|
||||
{
|
||||
MY_FT_PARSER_PARAM my_param;
|
||||
@ -320,7 +321,7 @@ int maria_ft_parse(TREE *wtree, uchar *doc, int doclen,
|
||||
param->mysql_add_word= maria_ft_add_word;
|
||||
param->mysql_ftparam= &my_param;
|
||||
param->cs= wtree->custom_arg;
|
||||
param->doc= (char *) doc;
|
||||
param->doc= doc;
|
||||
param->length= doclen;
|
||||
param->mode= MYSQL_FTPARSER_SIMPLE_MODE;
|
||||
DBUG_RETURN(parser->parse(param));
|
||||
@ -380,8 +381,8 @@ MYSQL_FTPARSER_PARAM *maria_ftparser_call_initializer(MARIA_HA *info,
|
||||
mysql_add_word != 0 - parser is initialized, or no
|
||||
initialization needed. */
|
||||
info->ftparser_param[ftparser_nr].mysql_add_word=
|
||||
(int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
|
||||
(int (*)(struct st_mysql_ftparser_param *, const uchar *,
|
||||
mysql_ft_size_t, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
|
||||
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
|
||||
return 0;
|
||||
}
|
||||
|
@ -122,15 +122,17 @@ void _ma_ft_segiterator_dummy_init(const uchar *, uint, FT_SEG_ITERATOR *);
|
||||
uint _ma_ft_segiterator(FT_SEG_ITERATOR *);
|
||||
|
||||
void maria_ft_parse_init(TREE *, CHARSET_INFO *);
|
||||
int maria_ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
|
||||
int maria_ft_parse(TREE *, uchar *, size_t, struct st_mysql_ftparser *parser,
|
||||
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
|
||||
FT_WORD * maria_ft_linearize(TREE *, MEM_ROOT *);
|
||||
FT_WORD * _ma_ft_parserecord(MARIA_HA *, uint, const uchar *, MEM_ROOT *);
|
||||
uint _ma_ft_parse(TREE *, MARIA_HA *, uint, const uchar *,
|
||||
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
|
||||
|
||||
FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, uint, uint, uchar *);
|
||||
FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, uint, CHARSET_INFO *);
|
||||
FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, size_t, uint,
|
||||
uchar *);
|
||||
FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, size_t,
|
||||
CHARSET_INFO *);
|
||||
|
||||
extern const struct _ft_vft _ma_ft_vft_nlq;
|
||||
int maria_ft_nlq_read_next(FT_INFO *, char *);
|
||||
|
@ -53,7 +53,7 @@ static struct my_option my_long_options[] =
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int error=0, subkeys;
|
||||
int error=0;
|
||||
uint keylen, keylen2=0, inx, doc_cnt=0;
|
||||
float weight= 1.0;
|
||||
double gws, min_gws=0, avg_gws=0;
|
||||
@ -112,11 +112,12 @@ int main(int argc,char *argv[])
|
||||
|
||||
while (!(error=maria_rnext(info,NULL,inx)))
|
||||
{
|
||||
FT_WEIGTH subkeys;
|
||||
keylen=*(info->lastkey_buff);
|
||||
|
||||
subkeys=ft_sintXkorr(info->lastkey_buff + keylen + 1);
|
||||
if (subkeys >= 0)
|
||||
weight=*(float*) (char*) &subkeys;
|
||||
subkeys.i= ft_sintXkorr(info->lastkey_buff + keylen + 1);
|
||||
if (subkeys.i >= 0)
|
||||
weight= subkeys.f;
|
||||
|
||||
#ifdef HAVE_SNPRINTF
|
||||
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);
|
||||
@ -153,14 +154,15 @@ int main(int argc,char *argv[])
|
||||
keylen2=keylen;
|
||||
doc_cnt=0;
|
||||
}
|
||||
doc_cnt+= (subkeys >= 0 ? 1 : -subkeys);
|
||||
doc_cnt+= (subkeys.i >= 0 ? 1 : -subkeys.i);
|
||||
}
|
||||
if (dump)
|
||||
{
|
||||
if (subkeys>=0)
|
||||
if (subkeys.i >= 0)
|
||||
printf("%9lx %20.7f %s\n", (long) info->cur_row.lastpos,weight,buf);
|
||||
else
|
||||
printf("%9lx => %17d %s\n",(long) info->cur_row.lastpos,-subkeys,buf);
|
||||
printf("%9lx => %17d %s\n",(long) info->cur_row.lastpos,-subkeys.i,
|
||||
buf);
|
||||
}
|
||||
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
|
||||
printf("%10ld\r",total);
|
||||
|
@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
|
||||
|
||||
|
||||
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *word, size_t word_len,
|
||||
const uchar *word, mysql_ft_size_t word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *info)
|
||||
{
|
||||
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
|
||||
@ -282,7 +282,7 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
|
||||
|
||||
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *query, size_t len)
|
||||
const uchar *query, mysql_ft_size_t len)
|
||||
{
|
||||
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO info;
|
||||
@ -616,7 +616,7 @@ typedef struct st_my_ftb_phrase_param
|
||||
|
||||
|
||||
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *word, size_t word_len,
|
||||
const uchar *word, mysql_ft_size_t word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
|
||||
{
|
||||
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
|
||||
@ -648,7 +648,8 @@ static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
|
||||
|
||||
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *document, size_t len)
|
||||
const uchar *document,
|
||||
mysql_ft_size_t len)
|
||||
{
|
||||
FT_WORD word;
|
||||
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
|
||||
@ -874,8 +875,9 @@ typedef struct st_my_ftb_find_param
|
||||
|
||||
|
||||
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *word, size_t len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
|
||||
const uchar *word, mysql_ft_size_t len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO
|
||||
*boolean_info __attribute__((unused)))
|
||||
{
|
||||
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
|
||||
FT_INFO *ftb= ftb_param->ftb;
|
||||
@ -935,7 +937,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
|
||||
|
||||
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *doc, size_t len)
|
||||
const uchar *doc, mysql_ft_size_t len)
|
||||
{
|
||||
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
|
||||
FT_INFO *ftb= ftb_param->ftb;
|
||||
|
@ -63,7 +63,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)),
|
||||
|
||||
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
{
|
||||
int32 subkeys;
|
||||
FT_WEIGTH subkeys;
|
||||
int r;
|
||||
uint keylen, doc_cnt;
|
||||
FT_SUPERDOC sdoc, *sptr;
|
||||
@ -91,7 +91,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
/* Skip rows inserted by current inserted */
|
||||
for (r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root) ;
|
||||
!r &&
|
||||
(subkeys=ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
|
||||
(subkeys.i= ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
|
||||
info->lastpos >= info->state->data_file_length ;
|
||||
r= _mi_search_next(info, keyinfo, info->lastkey,
|
||||
info->lastkey_length, SEARCH_BIGGER, key_root))
|
||||
@ -108,7 +108,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
info->lastkey_length-extra-1, keybuff+1,keylen-1,0,0))
|
||||
break;
|
||||
|
||||
if (subkeys<0)
|
||||
if (subkeys.i < 0)
|
||||
{
|
||||
if (doc_cnt)
|
||||
DBUG_RETURN(1); /* index is corrupted */
|
||||
@ -125,7 +125,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
}
|
||||
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
|
||||
/* The weight we read was actually a float */
|
||||
tmp_weight=*(float*) (char*) &subkeys;
|
||||
tmp_weight= subkeys.f;
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
@ -162,7 +162,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
||||
r=_mi_search(info, keyinfo, info->lastkey, info->lastkey_length,
|
||||
SEARCH_BIGGER, key_root);
|
||||
do_skip:
|
||||
while ((subkeys=ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
|
||||
while ((subkeys.i= ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
|
||||
!r && info->lastpos >= info->state->data_file_length)
|
||||
r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
|
||||
SEARCH_BIGGER, key_root);
|
||||
|
@ -258,7 +258,7 @@ void ft_parse_init(TREE *wtree, CHARSET_INFO *cs)
|
||||
|
||||
|
||||
static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *word, size_t word_len,
|
||||
const uchar *word, mysql_ft_size_t word_len,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
|
||||
__attribute__((unused)))
|
||||
{
|
||||
@ -288,7 +288,7 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
|
||||
|
||||
|
||||
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
|
||||
const uchar *doc_arg, size_t doc_len)
|
||||
const uchar *doc_arg, mysql_ft_size_t doc_len)
|
||||
{
|
||||
const uchar *doc= doc_arg;
|
||||
const uchar *end= doc + doc_len;
|
||||
@ -379,8 +379,8 @@ MYSQL_FTPARSER_PARAM *ftparser_call_initializer(MI_INFO *info,
|
||||
mysql_add_word != 0 - parser is initialized, or no
|
||||
initialization needed. */
|
||||
info->ftparser_param[ftparser_nr].mysql_add_word=
|
||||
(int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
|
||||
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
|
||||
(int (*)(struct st_mysql_ftparser_param *, const uchar *,
|
||||
mysql_ft_size_t, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
|
||||
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
|
||||
return 0;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ static struct my_option my_long_options[] =
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int error=0, subkeys;
|
||||
int error=0;
|
||||
uint keylen, keylen2=0, inx, doc_cnt=0;
|
||||
float weight= 1.0;
|
||||
double gws, min_gws=0, avg_gws=0;
|
||||
@ -109,11 +109,12 @@ int main(int argc,char *argv[])
|
||||
|
||||
while (!(error=mi_rnext(info,NULL,inx)))
|
||||
{
|
||||
FT_WEIGTH subkeys;
|
||||
keylen=*(info->lastkey);
|
||||
|
||||
subkeys=ft_sintXkorr(info->lastkey+keylen+1);
|
||||
if (subkeys >= 0)
|
||||
weight= *(float*) (char*) &subkeys;
|
||||
subkeys.i =ft_sintXkorr(info->lastkey+keylen+1);
|
||||
if (subkeys.i >= 0)
|
||||
weight= subkeys.f;
|
||||
|
||||
#ifdef HAVE_SNPRINTF
|
||||
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
|
||||
@ -150,14 +151,14 @@ int main(int argc,char *argv[])
|
||||
keylen2=keylen;
|
||||
doc_cnt=0;
|
||||
}
|
||||
doc_cnt+= (subkeys >= 0 ? 1 : -subkeys);
|
||||
doc_cnt+= (subkeys.i >= 0 ? 1 : -subkeys.i);
|
||||
}
|
||||
if (dump)
|
||||
{
|
||||
if (subkeys>=0)
|
||||
if (subkeys.i >= 0)
|
||||
printf("%9lx %20.7f %s\n", (long) info->lastpos,weight,buf);
|
||||
else
|
||||
printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys,buf);
|
||||
printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys.i,buf);
|
||||
}
|
||||
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
|
||||
printf("%10ld\r",total);
|
||||
|
Loading…
x
Reference in New Issue
Block a user