Loading Docs/manual.texi +24 −1 Original line number Diff line number Diff line Loading @@ -12423,6 +12423,12 @@ mysql> SELECT name, birth FROM pet ORDER BY birth; +----------+------------+ @end example On character type columns, sorting@-like all other comparison operations@-is normally performed in a case-insensitive fashion. This means that the order will be undefined for columns that are identical except for their case. You can force a case-sensitive sort by using the BINARY cast: @code{ORDER BY BINARY(field)}. To sort in reverse order, add the @code{DESC} (descending) keyword to the name of the column you are sorting by: Loading Loading @@ -29339,6 +29345,15 @@ interpreted as the year @code{'2010-11-12'}. The value @code{'10:45:15'} will be converted to @code{'0000-00-00'} because @code{'45'} is not a legal month. @item The MySQL server only performs basic checking on the validity of a date: days @code{00-31}, months @code{00-12}, years @code{1000-9999}. Any date not within this range will revert to @code{0000-00-00}. Please note that this still allows you to store invalid dates such as @code{2002-04-31}. It allows web applications to store data from a form without further checking. To ensure a date is valid, perform a check in your application. @item Year values specified as two digits are ambiguous, because the century is unknown. MySQL interprets 2-digit year values using the following Loading Loading @@ -49098,7 +49113,15 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item Query cache disabled in @code{mysqldump}. Fixed bug in phrase operator @code{"..."} in boolean fulltext search. @item Fixed bug that caused duplicated rows when using truncation operator @code{*} in boolean fulltext search. @item Fixed bug in boolean fulltext search, that caused a crash when an identical @code{MATCH} expression that did not use an index appeared twice. @item Query cache disabled in mysqldump. @item Fixed problem on Windows 98 that made sending of results very slow. @item include/my_getopt.h +2 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ C_MODE_START enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_LONG, GET_LL, GET_STR }; enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG, GET_ULONG, GET_LL, GET_ULL, GET_STR }; enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG }; struct my_option Loading myisam/ft_boolean_search.c +44 −12 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ typedef struct st_ftb_word { my_off_t docid[2]; /* for index search and for scan */ uint ndepth; int len; /* ... there can be docid cache added here. SerG */ /* ... docid cache can be added here. SerG */ byte word[1]; } FTB_WORD; Loading @@ -90,6 +90,7 @@ typedef struct st_ft_info { uint with_scan; FTB_EXPR *root; QUEUE queue; TREE no_dupes; FTB_WORD **list; MEM_ROOT mem_root; } FTB; Loading Loading @@ -165,6 +166,7 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end, if ((ftbe->quot=param.quot)) ftb->with_scan|=2; if (param.yesno > 0) up->ythresh++; _ftb_parse_query(ftb, start, end, ftbe, depth+1); param.quot=0; break; case 3: /* right bracket */ if (up->quot) up->qend=param.quot; Loading @@ -174,6 +176,11 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end, return; } static int _ftb_no_dupes_cmp(void* not_used, const void *a,const void *b) { return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b))); } void _ftb_init_index_search(FT_INFO *ftb) { int i, r; Loading @@ -193,8 +200,8 @@ void _ftb_init_index_search(FT_INFO *ftb) { ftbw=(FTB_WORD *)(ftb->queue.root[i]); if (ftbw->flags&FTB_FLAG_TRUNC && (ftbw->up->ythresh > test(ftbw->flags&FTB_FLAG_YES))) if (ftbw->flags&FTB_FLAG_TRUNC) /* special treatment :(( */ if (ftbw->up->ythresh > test(ftbw->flags&FTB_FLAG_YES)) { /* no need to search for this prefix in the index - * it cannot ADD new matches, and to REMOVE half-matched Loading @@ -203,6 +210,21 @@ void _ftb_init_index_search(FT_INFO *ftb) ftbw->up->yweaks++; continue; } else { /* We have to index-search for this prefix. * It may cause duplicates, as in the index (sorted by <word,docid>) * <aaaa,row1> * <aabb,row2> * <aacc,row1> * Searching for "aa*" will find row1 twice... */ if (!is_tree_inited(& ftb->no_dupes)) { init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t), _ftb_no_dupes_cmp,0,0,0); } } r=_mi_search(info, keyinfo, (uchar*) ftbw->word, ftbw->len, SEARCH_FIND | SEARCH_BIGGER, keyroot); Loading Loading @@ -250,6 +272,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, default_charset_info : info->s->keyinfo[keynr].seg->charset); ftb->with_scan=0; bzero(& ftb->no_dupes, sizeof(TREE)); init_alloc_root(&ftb->mem_root, 1024, 1024); Loading Loading @@ -438,6 +461,11 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) ftbe->yesses>=(ftbe->ythresh-ftbe->yweaks) && !ftbe->nos) { /* curdoc matched ! */ if (is_tree_inited(& ftb->no_dupes) && tree_insert(& ftb->no_dupes, &curdoc, 0)->count >1) /* but it managed to get past this line once */ continue; info->lastpos=curdoc; info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); /* why is this ? */ Loading Loading @@ -523,6 +551,10 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) void ft_boolean_close_search(FT_INFO *ftb) { if (is_tree_inited(& ftb->no_dupes)) { delete_tree(& ftb->no_dupes); } free_root(& ftb->mem_root, MYF(0)); my_free((gptr)ftb,MYF(0)); } Loading myisam/ft_parser.c +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ byte ft_get_word(byte **start, byte *end, FT_WORD *word, FTB_PARAM *param) { if (true_word_char(*doc)) break; if (*doc == FTB_RQUOT && param->quot) { param->quot=doc-1; param->quot=doc; *start=doc+1; return 3; /* FTB_RBR */ } Loading mysql-test/r/fulltext.result +15 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,16 @@ Full-text search in MySQL implements vector space model 0 select * from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE); a b MySQL has now support for full-text search select * from t1 where MATCH a,b AGAINST ('"text search" "now support"' IN BOOLEAN MODE); a b MySQL has now support for full-text search Full-text search in MySQL implements vector space model select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE); a b Full-text search in MySQL implements vector space model select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE); a b MySQL has now support for full-text search select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE); a b Full-text search in MySQL implements vector space model Loading Loading @@ -173,4 +183,9 @@ CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM; insert into t1 values (1,"I wonder why the fulltext index doesnt work?"); SELECT * from t1 where MATCH (b) AGAINST ('apples'); a b insert into t1 values (2,"fullaaa fullzzz"); select * from t1 where match b against ('full*' in boolean mode); a b 2 fullaaa fullzzz 1 I wonder why the fulltext index doesnt work? drop table t1; Loading
Docs/manual.texi +24 −1 Original line number Diff line number Diff line Loading @@ -12423,6 +12423,12 @@ mysql> SELECT name, birth FROM pet ORDER BY birth; +----------+------------+ @end example On character type columns, sorting@-like all other comparison operations@-is normally performed in a case-insensitive fashion. This means that the order will be undefined for columns that are identical except for their case. You can force a case-sensitive sort by using the BINARY cast: @code{ORDER BY BINARY(field)}. To sort in reverse order, add the @code{DESC} (descending) keyword to the name of the column you are sorting by: Loading Loading @@ -29339,6 +29345,15 @@ interpreted as the year @code{'2010-11-12'}. The value @code{'10:45:15'} will be converted to @code{'0000-00-00'} because @code{'45'} is not a legal month. @item The MySQL server only performs basic checking on the validity of a date: days @code{00-31}, months @code{00-12}, years @code{1000-9999}. Any date not within this range will revert to @code{0000-00-00}. Please note that this still allows you to store invalid dates such as @code{2002-04-31}. It allows web applications to store data from a form without further checking. To ensure a date is valid, perform a check in your application. @item Year values specified as two digits are ambiguous, because the century is unknown. MySQL interprets 2-digit year values using the following Loading Loading @@ -49098,7 +49113,15 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item Query cache disabled in @code{mysqldump}. Fixed bug in phrase operator @code{"..."} in boolean fulltext search. @item Fixed bug that caused duplicated rows when using truncation operator @code{*} in boolean fulltext search. @item Fixed bug in boolean fulltext search, that caused a crash when an identical @code{MATCH} expression that did not use an index appeared twice. @item Query cache disabled in mysqldump. @item Fixed problem on Windows 98 that made sending of results very slow. @item
include/my_getopt.h +2 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ C_MODE_START enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_LONG, GET_LL, GET_STR }; enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG, GET_ULONG, GET_LL, GET_ULL, GET_STR }; enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG }; struct my_option Loading
myisam/ft_boolean_search.c +44 −12 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ typedef struct st_ftb_word { my_off_t docid[2]; /* for index search and for scan */ uint ndepth; int len; /* ... there can be docid cache added here. SerG */ /* ... docid cache can be added here. SerG */ byte word[1]; } FTB_WORD; Loading @@ -90,6 +90,7 @@ typedef struct st_ft_info { uint with_scan; FTB_EXPR *root; QUEUE queue; TREE no_dupes; FTB_WORD **list; MEM_ROOT mem_root; } FTB; Loading Loading @@ -165,6 +166,7 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end, if ((ftbe->quot=param.quot)) ftb->with_scan|=2; if (param.yesno > 0) up->ythresh++; _ftb_parse_query(ftb, start, end, ftbe, depth+1); param.quot=0; break; case 3: /* right bracket */ if (up->quot) up->qend=param.quot; Loading @@ -174,6 +176,11 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end, return; } static int _ftb_no_dupes_cmp(void* not_used, const void *a,const void *b) { return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b))); } void _ftb_init_index_search(FT_INFO *ftb) { int i, r; Loading @@ -193,8 +200,8 @@ void _ftb_init_index_search(FT_INFO *ftb) { ftbw=(FTB_WORD *)(ftb->queue.root[i]); if (ftbw->flags&FTB_FLAG_TRUNC && (ftbw->up->ythresh > test(ftbw->flags&FTB_FLAG_YES))) if (ftbw->flags&FTB_FLAG_TRUNC) /* special treatment :(( */ if (ftbw->up->ythresh > test(ftbw->flags&FTB_FLAG_YES)) { /* no need to search for this prefix in the index - * it cannot ADD new matches, and to REMOVE half-matched Loading @@ -203,6 +210,21 @@ void _ftb_init_index_search(FT_INFO *ftb) ftbw->up->yweaks++; continue; } else { /* We have to index-search for this prefix. * It may cause duplicates, as in the index (sorted by <word,docid>) * <aaaa,row1> * <aabb,row2> * <aacc,row1> * Searching for "aa*" will find row1 twice... */ if (!is_tree_inited(& ftb->no_dupes)) { init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t), _ftb_no_dupes_cmp,0,0,0); } } r=_mi_search(info, keyinfo, (uchar*) ftbw->word, ftbw->len, SEARCH_FIND | SEARCH_BIGGER, keyroot); Loading Loading @@ -250,6 +272,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, default_charset_info : info->s->keyinfo[keynr].seg->charset); ftb->with_scan=0; bzero(& ftb->no_dupes, sizeof(TREE)); init_alloc_root(&ftb->mem_root, 1024, 1024); Loading Loading @@ -438,6 +461,11 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) ftbe->yesses>=(ftbe->ythresh-ftbe->yweaks) && !ftbe->nos) { /* curdoc matched ! */ if (is_tree_inited(& ftb->no_dupes) && tree_insert(& ftb->no_dupes, &curdoc, 0)->count >1) /* but it managed to get past this line once */ continue; info->lastpos=curdoc; info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); /* why is this ? */ Loading Loading @@ -523,6 +551,10 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) void ft_boolean_close_search(FT_INFO *ftb) { if (is_tree_inited(& ftb->no_dupes)) { delete_tree(& ftb->no_dupes); } free_root(& ftb->mem_root, MYF(0)); my_free((gptr)ftb,MYF(0)); } Loading
myisam/ft_parser.c +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ byte ft_get_word(byte **start, byte *end, FT_WORD *word, FTB_PARAM *param) { if (true_word_char(*doc)) break; if (*doc == FTB_RQUOT && param->quot) { param->quot=doc-1; param->quot=doc; *start=doc+1; return 3; /* FTB_RBR */ } Loading
mysql-test/r/fulltext.result +15 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,16 @@ Full-text search in MySQL implements vector space model 0 select * from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE); a b MySQL has now support for full-text search select * from t1 where MATCH a,b AGAINST ('"text search" "now support"' IN BOOLEAN MODE); a b MySQL has now support for full-text search Full-text search in MySQL implements vector space model select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE); a b Full-text search in MySQL implements vector space model select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE); a b MySQL has now support for full-text search select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE); a b Full-text search in MySQL implements vector space model Loading Loading @@ -173,4 +183,9 @@ CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM; insert into t1 values (1,"I wonder why the fulltext index doesnt work?"); SELECT * from t1 where MATCH (b) AGAINST ('apples'); a b insert into t1 values (2,"fullaaa fullzzz"); select * from t1 where match b against ('full*' in boolean mode); a b 2 fullaaa fullzzz 1 I wonder why the fulltext index doesnt work? drop table t1;