Commit 4f4f20d4 authored by unknown's avatar unknown
Browse files

MATCH(a,b) AGAINST (... IN NATURAL LANGUAGE MODE)

remove explicit $<ulong_num>$ from sql_yacc.yy


mysql-test/r/fulltext.result:
  MATCH(a,b) AGAINST (... IN NATURAL LANGUAGE MODE)
mysql-test/t/fulltext.test:
  MATCH(a,b) AGAINST (... IN NATURAL LANGUAGE MODE)
parent 3649a68f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -41,6 +41,15 @@ a b
Full-text indexes	are called collections
Only MyISAM tables	support collections
MySQL has now support	for full-text search
select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE);
a	b
Full-text indexes	are called collections
select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
a	b
Full-text indexes	are called collections
Only MyISAM tables	support collections
select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WITH QUERY EXPANSION)' at line 1
explain select * from t1 where MATCH(a,b) AGAINST ("collections");
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	fulltext	a	a	0		1	Using where
+6 −0
Original line number Diff line number Diff line
@@ -28,6 +28,12 @@ select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);

# IN NATURAL LANGUAGE MODE
select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE);
select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
--error 1064
select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);

# add_ft_keys() tests

explain select * from t1 where MATCH(a,b) AGAINST ("collections");
+75 −66
Original line number Diff line number Diff line
@@ -746,6 +746,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
        opt_ignore_leaves fulltext_options spatial_type union_option
        start_transaction_opts opt_chain opt_release
        union_opt select_derived_init option_type2
        opt_natural_language_mode opt_query_expansion
        opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment
        ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt

%type <ulong_num>
	ulong_num merge_insert_types
@@ -1451,13 +1454,13 @@ ev_schedule_time: EVERY_SYM expr interval
          }
      ;

opt_ev_status: /* empty */ {$<ulong_num>$= 0;}
opt_ev_status: /* empty */ { $$= 0; }
        | ENABLE_SYM
          {
            LEX *lex=Lex;
            if (!lex->et_compile_phase)
              lex->et->status= MYSQL_EVENT_ENABLED;
            $<ulong_num>$= 1;	   
            $$= 1;
          }
        | DISABLE_SYM
          {
@@ -1465,7 +1468,7 @@ opt_ev_status: /* empty */ {$<ulong_num>$= 0;}

            if (!lex->et_compile_phase)
              lex->et->status= MYSQL_EVENT_DISABLED;
            $<ulong_num>$= 1;
            $$= 1;
          }
      ;

@@ -1516,7 +1519,7 @@ ev_ends: /* empty */
          }
      ;

opt_ev_on_completion: /* empty */ {$<ulong_num>$= 0;}
opt_ev_on_completion: /* empty */ { $$= 0; }
        | ev_on_completion
      ;

@@ -1526,18 +1529,18 @@ ev_on_completion:
            LEX *lex=Lex;
            if (!lex->et_compile_phase)
              lex->et->on_completion= MYSQL_EVENT_ON_COMPLETION_PRESERVE;
            $<ulong_num>$= 1;
            $$= 1;
          }
        | ON COMPLETION_SYM NOT_SYM PRESERVE_SYM
          {
            LEX *lex=Lex;
            if (!lex->et_compile_phase)
              lex->et->on_completion= MYSQL_EVENT_ON_COMPLETION_DROP;
            $<ulong_num>$= 1;
            $$= 1;
          }
      ;

opt_ev_comment: /* empty */ {$<ulong_num>$= 0;}
opt_ev_comment: /* empty */ { $$= 0; }
        | COMMENT_SYM TEXT_STRING_sys
          {
            LEX *lex= Lex;
@@ -1546,7 +1549,7 @@ opt_ev_comment: /* empty */ {$<ulong_num>$= 0;}
              lex->comment= $2;
              lex->et->init_comment(YYTHD, &$2);
            }
            $<ulong_num>$= 1;
            $$= 1;
          }
      ;

@@ -1607,7 +1610,7 @@ ev_sql_stmt_inner:
        | sp_proc_stmt_if
        | sp_proc_stmt_case_simple
        | sp_proc_stmt_case
        | sp_labeled_control {}
        | sp_labeled_control
        | sp_proc_stmt_unlabeled
        | sp_proc_stmt_leave
        | sp_proc_stmt_iterate
@@ -2286,7 +2289,6 @@ sp_proc_stmt:
	| sp_proc_stmt_case_simple
        | sp_proc_stmt_case
	| sp_labeled_control
	  {}
	| sp_proc_stmt_unlabeled
	| sp_proc_stmt_leave
	| sp_proc_stmt_iterate
@@ -4853,8 +4855,7 @@ alter:
              sql_command is set here because some rules in ev_sql_stmt
              can overwrite it
            */
            if (!($<ulong_num>5 || $<ulong_num>6 || $<ulong_num>7 ||
                  $<ulong_num>8 || $<ulong_num>9))
            if (!($5 || $6 || $7 || $8 || $9))
            {
	      yyerror(ER(ER_SYNTAX_ERROR));
              YYABORT;
@@ -4883,27 +4884,24 @@ alter:
          }
	;

ev_alter_on_schedule_completion: /* empty */ { $<ulong_num>$= 0;}
        | ON SCHEDULE_SYM ev_schedule_time { $<ulong_num>$= 1; }
        | ev_on_completion { $<ulong_num>$= 1; }
        | ON SCHEDULE_SYM ev_schedule_time ev_on_completion { $<ulong_num>$= 1; }
ev_alter_on_schedule_completion: /* empty */ { $$= 0;}
        | ON SCHEDULE_SYM ev_schedule_time { $$= 1; }
        | ev_on_completion { $$= 1; }
        | ON SCHEDULE_SYM ev_schedule_time ev_on_completion { $$= 1; }
      ;

opt_ev_rename_to: /* empty */ { $<ulong_num>$= 0;}
opt_ev_rename_to: /* empty */ { $$= 0;}
        | RENAME TO_SYM sp_name
          {
            LEX *lex=Lex;
            lex->spname= $3; //use lex's spname to hold the new name
	                     //the original name is in the event_timed object
            $<ulong_num>$= 1;
            $$= 1;
          }
      ;

opt_ev_sql_stmt: /* empty*/ { $<ulong_num>$= 0;}
        | DO_SYM ev_sql_stmt
          {
            $<ulong_num>$= 1;
          }
opt_ev_sql_stmt: /* empty*/ { $$= 0;}
        | DO_SYM ev_sql_stmt { $$= 1; }
        ;


@@ -6625,9 +6623,20 @@ geometry_function:
	;

fulltext_options:
          opt_natural_language_mode opt_query_expansion
          { $$= $1 | $2; }
        | IN_SYM BOOLEAN_SYM MODE_SYM
          { $$= FT_BOOL; }
        ;

opt_natural_language_mode:
        /* nothing */                           { $$= FT_NL;  }
        | WITH QUERY_SYM EXPANSION_SYM  { $$= FT_NL | FT_EXPAND; }
        | IN_SYM BOOLEAN_SYM MODE_SYM   { $$= FT_BOOL; }
        | IN_SYM NATURAL LANGUAGE_SYM MODE_SYM  { $$= FT_NL; }
        ;

opt_query_expansion:
        /* nothing */                           { $$= 0;         }
        | WITH QUERY_SYM EXPANSION_SYM          { $$= FT_EXPAND; }
        ;

udf_expr_list: