Loading Docs/manual.texi +10 −6 Original line number Diff line number Diff line Loading @@ -29167,8 +29167,6 @@ mysql> select STRCMP('text', 'text'); relevance - similarity measure between the text in columns @code{(col1,col2,...)} and the query @code{expr}. Relevance is a positive floating-point number. Zero relevance means no similarity. For @code{MATCH ... AGAINST()} to work, a @strong{FULLTEXT} index must be created first. @xref{CREATE TABLE, , @code{CREATE TABLE}}. @code{MATCH ... AGAINST()} is available in MySQL version 3.23.23 or later. @code{IN BOOLEAN MODE} extension was added in version 4.0.1. For details and usage examples @pxref{Fulltext Search}. Loading Loading @@ -33828,9 +33826,10 @@ mysql> SELECT * FROM articles WHERE MATCH (title,body) AGAINST ( This query retrieved all the rows that contain the word @code{MySQL} (note: 50% threshold is gone), but does @strong{not} contain the word @code{YourSQL}. Note that it does not auto-magically sort rows in @code{YourSQL}. Note, that it does not auto-magically sort rows in derceasing relevance order (the last row has the highest relevance, as it contains @code{MySQL} twice). as it contains @code{MySQL} twice). Boolean fulltext search can also work even without @code{FULLTEXT} index, but it would be @strong{slow}. Boolean fulltext search supports the following operators: Loading Loading @@ -33890,10 +33889,12 @@ order), but rank ``gates to hell'' higher than ``bill gates''. @itemize @bullet @item All parameters to the @code{MATCH} function must be columns from the same table that is part of the same fulltext index. same table that is part of the same fulltext index, unless this @code{MATCH} is @code{IN BOOLEAN MODE}. @item Column list between @code{MATCH} and @code{AGAINST} must match exactly a column list in the @code{FULLTEXT} index definition. a column list in the @code{FULLTEXT} index definition, unless this @code{MATCH} is @code{IN BOOLEAN MODE}. @item The argument to @code{AGAINST} must be a constant string. @end itemize Loading Loading @@ -45853,6 +45854,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item @code{MATCH ... AGAINST(... IN BOOLEAN MODE)} can now work without @code{FULLTEXT} index. @item Added @file{myisam/ft_dump} utility for low-level inspection of @code{FULLTEXT} indexes. @item include/ft_global.h +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ extern "C" { typedef struct st_ft_info FT_INFO; struct _ft_vft { int (*read_next)(FT_INFO *, char *); float (*find_relevance)(FT_INFO *, my_off_t, byte *); float (*find_relevance)(FT_INFO *, byte *, uint); void (*close_search)(FT_INFO *); float (*get_relevance)(FT_INFO *); void (*reinit_search)(FT_INFO *); Loading include/my_base.h +1 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ enum ha_base_keytype { /* Other constants */ #define HA_NAMELEN 64 /* Max length of saved filename */ #define NO_SUCH_KEY ((uint)~0) /* used as a key no. */ /* Intern constants in databases */ Loading myisam/ft_boolean_search.c +15 −7 Original line number Diff line number Diff line Loading @@ -152,13 +152,16 @@ void _ftb_init_index_search(FT_INFO *ftb) int i, r; FTB_WORD *ftbw; MI_INFO *info=ftb->info; MI_KEYDEF *keyinfo=info->s->keyinfo+ftb->keynr; my_off_t keyroot=info->s->state.key_root[ftb->keynr]; MI_KEYDEF *keyinfo; my_off_t keyroot; if (ftb->state != READY) if (ftb->state != READY || ftb->keynr == NO_SUCH_KEY) return; ftb->state=INDEX_SEARCH; keyinfo=info->s->keyinfo+ftb->keynr; keyroot=info->s->state.key_root[ftb->keynr]; for (i=ftb->queue.elements; i; i--) { ftbw=(FTB_WORD *)(ftb->queue.root[i]); Loading Loading @@ -352,14 +355,17 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) return my_errno=HA_ERR_END_OF_FILE; } float ft_boolean_find_relevance(FT_INFO *ftb, my_off_t docid, byte *record) float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) { TREE ptree; FT_WORD word; FTB_WORD *ftbw; FTB_EXPR *ftbe; uint i; my_off_t docid=ftb->info->lastpos; if (docid == HA_POS_ERROR) return -2.0; if (ftb->state == READY || ftb->state == INDEX_DONE) { for (i=1; i<=ftb->queue.elements; i++) Loading @@ -382,11 +388,13 @@ float ft_boolean_find_relevance(FT_INFO *ftb, my_off_t docid, byte *record) ftb->state=SCAN; } else if (ftb->state != SCAN) return -2.0; return -3.0; bzero(&ptree, sizeof(ptree)); if (_mi_ft_parse(& ptree, ftb->info, ftb->keynr, record)) return -3.0; if ((ftb->keynr==NO_SUCH_KEY) ? ft_parse(& ptree, record, length) : _mi_ft_parse(& ptree, ftb->info, ftb->keynr, record)) return -4.0; for (i=1; i<=ftb->queue.elements; i++) { Loading myisam/ft_dump.c +10 −2 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ int main(int argc,char *argv[]) return 0; } const char *options="dscve:h"; const char *options="dscvh"; static void get_options(int argc, char *argv[]) { Loading @@ -184,7 +184,15 @@ static void get_options(int argc, char *argv[]) static void usage(char *argv[]) { printf("Use: %s [-%s] <table_name> <key_no>\n", *argv, options); printf(" Use: %s [-%s] <table_name> <index_no> -d dump index (incl. data offsets and word weights) -s report global stats -c calculate per-word stats (counts and global weights) -v be verbose -h this text\n ", *argv, options); exit(1); } Loading Loading
Docs/manual.texi +10 −6 Original line number Diff line number Diff line Loading @@ -29167,8 +29167,6 @@ mysql> select STRCMP('text', 'text'); relevance - similarity measure between the text in columns @code{(col1,col2,...)} and the query @code{expr}. Relevance is a positive floating-point number. Zero relevance means no similarity. For @code{MATCH ... AGAINST()} to work, a @strong{FULLTEXT} index must be created first. @xref{CREATE TABLE, , @code{CREATE TABLE}}. @code{MATCH ... AGAINST()} is available in MySQL version 3.23.23 or later. @code{IN BOOLEAN MODE} extension was added in version 4.0.1. For details and usage examples @pxref{Fulltext Search}. Loading Loading @@ -33828,9 +33826,10 @@ mysql> SELECT * FROM articles WHERE MATCH (title,body) AGAINST ( This query retrieved all the rows that contain the word @code{MySQL} (note: 50% threshold is gone), but does @strong{not} contain the word @code{YourSQL}. Note that it does not auto-magically sort rows in @code{YourSQL}. Note, that it does not auto-magically sort rows in derceasing relevance order (the last row has the highest relevance, as it contains @code{MySQL} twice). as it contains @code{MySQL} twice). Boolean fulltext search can also work even without @code{FULLTEXT} index, but it would be @strong{slow}. Boolean fulltext search supports the following operators: Loading Loading @@ -33890,10 +33889,12 @@ order), but rank ``gates to hell'' higher than ``bill gates''. @itemize @bullet @item All parameters to the @code{MATCH} function must be columns from the same table that is part of the same fulltext index. same table that is part of the same fulltext index, unless this @code{MATCH} is @code{IN BOOLEAN MODE}. @item Column list between @code{MATCH} and @code{AGAINST} must match exactly a column list in the @code{FULLTEXT} index definition. a column list in the @code{FULLTEXT} index definition, unless this @code{MATCH} is @code{IN BOOLEAN MODE}. @item The argument to @code{AGAINST} must be a constant string. @end itemize Loading Loading @@ -45853,6 +45854,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item @code{MATCH ... AGAINST(... IN BOOLEAN MODE)} can now work without @code{FULLTEXT} index. @item Added @file{myisam/ft_dump} utility for low-level inspection of @code{FULLTEXT} indexes. @item
include/ft_global.h +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ extern "C" { typedef struct st_ft_info FT_INFO; struct _ft_vft { int (*read_next)(FT_INFO *, char *); float (*find_relevance)(FT_INFO *, my_off_t, byte *); float (*find_relevance)(FT_INFO *, byte *, uint); void (*close_search)(FT_INFO *); float (*get_relevance)(FT_INFO *); void (*reinit_search)(FT_INFO *); Loading
include/my_base.h +1 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ enum ha_base_keytype { /* Other constants */ #define HA_NAMELEN 64 /* Max length of saved filename */ #define NO_SUCH_KEY ((uint)~0) /* used as a key no. */ /* Intern constants in databases */ Loading
myisam/ft_boolean_search.c +15 −7 Original line number Diff line number Diff line Loading @@ -152,13 +152,16 @@ void _ftb_init_index_search(FT_INFO *ftb) int i, r; FTB_WORD *ftbw; MI_INFO *info=ftb->info; MI_KEYDEF *keyinfo=info->s->keyinfo+ftb->keynr; my_off_t keyroot=info->s->state.key_root[ftb->keynr]; MI_KEYDEF *keyinfo; my_off_t keyroot; if (ftb->state != READY) if (ftb->state != READY || ftb->keynr == NO_SUCH_KEY) return; ftb->state=INDEX_SEARCH; keyinfo=info->s->keyinfo+ftb->keynr; keyroot=info->s->state.key_root[ftb->keynr]; for (i=ftb->queue.elements; i; i--) { ftbw=(FTB_WORD *)(ftb->queue.root[i]); Loading Loading @@ -352,14 +355,17 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) return my_errno=HA_ERR_END_OF_FILE; } float ft_boolean_find_relevance(FT_INFO *ftb, my_off_t docid, byte *record) float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) { TREE ptree; FT_WORD word; FTB_WORD *ftbw; FTB_EXPR *ftbe; uint i; my_off_t docid=ftb->info->lastpos; if (docid == HA_POS_ERROR) return -2.0; if (ftb->state == READY || ftb->state == INDEX_DONE) { for (i=1; i<=ftb->queue.elements; i++) Loading @@ -382,11 +388,13 @@ float ft_boolean_find_relevance(FT_INFO *ftb, my_off_t docid, byte *record) ftb->state=SCAN; } else if (ftb->state != SCAN) return -2.0; return -3.0; bzero(&ptree, sizeof(ptree)); if (_mi_ft_parse(& ptree, ftb->info, ftb->keynr, record)) return -3.0; if ((ftb->keynr==NO_SUCH_KEY) ? ft_parse(& ptree, record, length) : _mi_ft_parse(& ptree, ftb->info, ftb->keynr, record)) return -4.0; for (i=1; i<=ftb->queue.elements; i++) { Loading
myisam/ft_dump.c +10 −2 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ int main(int argc,char *argv[]) return 0; } const char *options="dscve:h"; const char *options="dscvh"; static void get_options(int argc, char *argv[]) { Loading @@ -184,7 +184,15 @@ static void get_options(int argc, char *argv[]) static void usage(char *argv[]) { printf("Use: %s [-%s] <table_name> <key_no>\n", *argv, options); printf(" Use: %s [-%s] <table_name> <index_no> -d dump index (incl. data offsets and word weights) -s report global stats -c calculate per-word stats (counts and global weights) -v be verbose -h this text\n ", *argv, options); exit(1); } Loading