Commit 49b6f02d authored by serg@serg.mysql.com's avatar serg@serg.mysql.com
Browse files

Merge

parents c0491194 4a5ca107
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -29398,8 +29398,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}.
@@ -34059,9 +34057,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:
@@ -34121,10 +34120,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
@@ -46083,6 +46084,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
Fixed slave to replicate from 3.23 master.
@item
Miscellaneous replication fixes/cleanup.
+1 −1
Original line number Diff line number Diff line
@@ -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 *);
+1 −0
Original line number Diff line number Diff line
@@ -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 */

+15 −7
Original line number Diff line number Diff line
@@ -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]);
@@ -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++)
@@ -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++)
  {
+10 −2
Original line number Diff line number Diff line
@@ -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[])
{
@@ -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