Commit a4d82ab8 authored by unknown's avatar unknown
Browse files

backport bug#2708 fix from 4.1


myisam/ft_boolean_search.c:
  perlify comment
parent a4237f3d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
}


/* returns 1 if str0 ~= /\<str1\>/ */
/* returns 1 if str0 ~= /\bstr1\b/ */
static int _ftb_strstr(const byte *s0, const byte *e0,
                const byte *s1, const byte *e1,
                CHARSET_INFO *cs)
+24 −16
Original line number Diff line number Diff line
@@ -124,20 +124,22 @@ byte ft_get_word(byte **start, byte *end, FT_WORD *word, FTB_PARAM *param)
    for (;doc<end;doc++)
    {
      if (true_word_char(*doc)) break;
      if (*doc == FTB_RQUOT && param->quot) {
      if (*doc == FTB_RQUOT && param->quot)
      {
        param->quot=doc;
        *start=doc+1;
        return 3; /* FTB_RBR */
      }
      if ((*doc == FTB_LBR || *doc == FTB_RBR || *doc == FTB_LQUOT)
          && !param->quot)
      if (!param->quot)
      {
        if (*doc == FTB_LBR || *doc == FTB_RBR || *doc == FTB_LQUOT)
        {
          /* param->prev=' '; */
          *start=doc+1;
          if (*doc == FTB_LQUOT) param->quot=*start;
          return (*doc == FTB_RBR)+2;
        }
      if (param->prev == ' ' && !param->quot)
        if (param->prev == ' ')
        {
          if (*doc == FTB_YES ) { param->yesno=+1;    continue; } else
          if (*doc == FTB_EGAL) { param->yesno= 0;    continue; } else
@@ -146,6 +148,7 @@ byte ft_get_word(byte **start, byte *end, FT_WORD *word, FTB_PARAM *param)
          if (*doc == FTB_DEC ) { param->plusminus--; continue; } else
          if (*doc == FTB_NEG ) { param->pmsign=!param->pmsign; continue; }
        }
      }
      param->prev=*doc;
      param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0);
      param->plusminus=param->pmsign=0;
@@ -170,6 +173,11 @@ byte ft_get_word(byte **start, byte *end, FT_WORD *word, FTB_PARAM *param)
      return 1;
    }
  }
  if (param->quot)
  {
    param->quot=*start=doc;
    return 3; /* FTB_RBR */
  }
  return 0;
}

+3 −0
Original line number Diff line number Diff line
@@ -122,6 +122,9 @@ select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN B
a	b
select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
a	b
select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
a	b
Full-text search in MySQL	implements vector space model
select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE);
a	b
Full-text search in MySQL	implements vector space model
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@ select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);

# bug#2708, bug#3870 crash

select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
 
# boolean w/o index:

select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE);