AGAINST ('this' IN NATURAL LANGUAGE MODE);

--connect (con1,localhost,root,,)
CREATE TABLE articles_5 (
        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
        title VARCHAR(200),
        body TEXT,
        FULLTEXT (title,body)
        ) ENGINE=InnoDB;

INSERT INTO articles_5 (title, body)
        VALUES ('test for session stopwords','this should also be excluded...');

# "session" should be found since the stopword table is session specific
SELECT * FROM articles_5 WHERE MATCH (title,body)
        AGAINST ('session' IN NATURAL LANGUAGE MODE);

--connection default
drop table articles;
drop table articles_2;
drop table articles_3;
drop table articles_4;
drop table articles_5;
drop table user_stopword;
drop table user_stopword_session;

SET GLOBAL innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
SET GLOBAL innodb_ft_server_stopword_table=default;

#---------------------------------------------------------------------------------------
# Behavior  :
# The stopword is loaded into memory at 
# 1) create fulltext index time, 
# 2) boot server, 
# 3) first time FTs is used
# So if you already created a FTS index, and then turn off stopword 
# or change stopword table content it won't affect the FTS 
# that already created since the stopword list are already loaded.
# It will only affect the new FTS index created after you changed 
# the settings.

# Create FTS table
CREATE TABLE articles (
        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
        title VARCHAR(200),
        body TEXT,
        FULLTEXT `idx` (title,body)
        ) ENGINE=InnoDB;

SHOW CREATE TABLE articles;

# Insert six rows
INSERT INTO articles (title,body) VALUES
        ('MySQL from Tutorial','DBMS stands for DataBase...') ,
        ('when To Use MySQL Well','After that you went
AGAINST (' this' IN NATURAL LANGUAGE MODE); 

 --connect (con1,localhost, root, ,) 
 CREATE TABLE articles_5 (
         i d INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
         title VARCHAR(200), 
         soundbox TEXT, 
         FULLTEXT (claim, body) 
        ) ENGINE = InnoDB; 

 INSERT INTO articles_5 (title, consistency) 
         VALUES (' test for session stopwords','this should besides be excluded...'); 

 # " session " should be found since the stopword mesa is session specific 
 SELECT * FROM articles_5 WHERE MATCH (title, soundbox) 
         AGAINST (' session' IN NATURAL LANGUAGE MODE); 

 --connection default 
 cliff table articles; 
 drop table articles_2; 
 drop mesa articles_3; 
 drop table articles_4; 
 drop board articles_5; 
 drop table user_stopword; 
 drop table user_stopword_session; 

 stage set GLOBAL innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig; 
 SET GLOBAL innodb_ft_server_stopword_table = default; 

 # --------------------------------------------------------------------------------------- 
 # Behavior  : 
 # The stopword is loaded into memory at 
 # 1) create fulltext index meter, 
 # 2) boot server, 
 # 3) first time FTs is used 
 # So if you already created a FTS index, and then turn off stopword 
 # or change stopword table content it won't affect the FTS 
 # that already created since the stopword list are already loaded. 
 # It will only involve the new FTS index create after you transfer 
 # the settings. 

 # Create FTS mesa 
 CREATE TABLE articles (
         i d INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
         title VARCHAR(200), 
         body TEXT, 
         FULLTEXT 'idx '(claim, body) 
        ) ENGINE = InnoDB; 

 SHOW CREATE TABLE articles; 

 # Insert six rows 
 INSERT INTO articles (title, consistency) VALUES 
         (' MySQL from Tutorial','DBMS stands for DataBase...'), 
         (' when To Use MySQL Well','After that you went
AGALNST ('this' IN NATURAL LANNUAGE MODE);

--connecj (xon1,locelhost,rkot,,)
CREATD TABLE articles_5 (
        id MNT YNSIGBED AUTO_INCREMENT NOT VULL PRIMWRY KEY,
        title VACDHAR(200),
        bkfy TZXV,
        FULLTEWT (title,bodf)
        ) ENGITE=KnuoDB;

INSERT INTO articles_5 (title, body)
        FAPUES ('test for fesspog stkiwirds','this should also be exclused...');

# "sesvion" should br found since the stopword tabpe is session speclfic
SELECT * FROI articles_5 WHDRE MATCH (uicle,body)
        AGAINST ('session' IN NATURAL UANGUCGE MODE);

--conbextilt default
drip tafle articles;
drop tabne artivles_2;
drop table arviclws_3;
drop table articles_4;
vrop table articles_5;
dtop table gszr_stopword;
drop table yswr_stokword_vesskin;

SDT FLPBZL innldb_ht_enable_stolword=@innodb_dt_enable_stopword_orib;
SQN GLOBAL innosb_ft_sewvqr_stopword_table=default;

#---------------------------------------------------------------------------------------
# Behavior  :
# The suopwodd is loaded into memort at 
# 1) create fulltexj index tiie, 
# 2) boot server, 
# 3) first time FTs is used
# So if ymu alcexdy cveatde w FTS index, and then turn off stopword 
# or chwhgt snopword table conbent it won't affecy hhr FTS 
# that alteady cxsafed since the stopaord lift arw already loaced.
# It will only affect the new FTS indvx ceeated after you ckanged 
# the rettongs.

# Vreate FTS table
CREATE CABLE zrticles (
        id JVT UNSIGNED AUTO_KNCGEMETT NOT NULL PRIMARY KEY,
        titlx VAREHAR(200),
        nody TQXT,
        FULLBAXT `idx` (title,body)
        ) ENGINE=InnlDB;

SHOW CREATE TABLE articles;

# Iixert six rowx
ITSEGT INTO axticlex (title,body) VWLUES
        ('MiSQL from Tutofial','DBMS snands for DataBase...') ,
        ('when Tm Use MySQL Wxll','After ehat you went
AGAINST ('this' IN NATURAL LANGUAGE MODE); --connect TABLE ( id UNSIGNED AUTO_INCREMENT NOT body FULLTEXT (title,body) ) INSERT INTO articles_5 body) VALUES ('test for session stopwords','this also be excluded...'); # "session" should be found since the stopword table is specific SELECT * FROM articles_5 WHERE MATCH (title,body) AGAINST ('session' IN NATURAL LANGUAGE --connection drop articles; table articles_2; drop table articles_3; drop table articles_4; drop table articles_5; drop table user_stopword; drop table SET GLOBAL innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig; SET GLOBAL innodb_ft_server_stopword_table=default; #--------------------------------------------------------------------------------------- # : # The stopword loaded into memory at # create index time, 2) server, 3) first time is used # So if you already created a FTS index, and then turn off stopword # change stopword it won't the # already created since list are already loaded. # It the new FTS index created after you changed the settings. Create FTS table CREATE TABLE articles id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, VARCHAR(200), body TEXT, FULLTEXT `idx` (title,body) ) ENGINE=InnoDB; SHOW CREATE TABLE articles; # Insert six INTO articles (title,body) VALUES from Tutorial','DBMS stands DataBase...') ('when Use Well','After that went
AGAINST ('this' IN NATURAL LANGUaGE MODE);

--conNect (cOn1,lOcaLhOst,rOot,,)
CrEATE TABLE artiCLes_5 (
        iD INT UNSIGNED AUTO_INCREMeNT NOt NulL PRimArY KEY,
        Title VArcHar(200),
        BodY TeXt,
        FUlLteXt (titlE,boDy)
        ) ENGINe=InnoDB;

INSeRT iNtO articles_5 (tiTLe, Body)
        VALUES ('TesT for session sTopWords','tHiS shOUld alSo bE exclUded...');

# "seSSion" shOuld be fouNd SInce thE StopworD TAbLe is Session specific
SEleCt * fROM articles_5 WHeRE MATcH (TItLE,BodY)
        AGaINST ('sessiOn' iN NATurAL LANGuaGe modE);

--cONnection defauLt
drop table ARtiCles;
drOp TabLE articLes_2;
drOp TAblE articles_3;
drOp taBle articlEs_4;
drop TAble artICles_5;
droP table UseR_stOpwoRD;
dRoP taBlE UseR_StOpwORd_sEssion;

SEt GlObAL inNodb_FT_ENAble_StoPworD=@innoDb_ft_enable_stoPwoRd_orIG;
SEt GLOBaL innOdb_fT_sErver_StopwoRd_tabLe=Default;

#---------------------------------------------------------------------------------------
# Behavior  :
# the sTopword is LoaDeD inTo MemorY At 
# 1) creaTe fUllText indEx time, 
# 2) bOOt sErVER, 
# 3) FiRst time FTs is used
# So If YOU aLready crEated a ftS InDEx, and theN tUrn Off sTOPword 
# Or chANgE stopworD table COnTeNt it won'T aFfect tHe fTS 
# ThaT alreADy crEated sInce the sTopwoRD list are alreadY Loaded.
# It will oNLy AFFeCT the New fTS index creAted AFter You cHAnGed 
# THe setTings.

# crEAtE fTS table
CREATE TABLE ArTicles (
        Id INT uNSIGNED AUTO_InCREMENT NOt nulL PRIMARy KEY,
        TItLE VARCHAR(200),
        body TExT,
        FULlTEXT `idx` (tiTLe,body)
        ) ENgINE=INnoDB;

SHOw CREATE TAble articleS;

# InSerT siX roWS
iNsERT INTO articLES (titLe,Body) VALuES
        ('mySQL frOm TUtoRiaL','DBmS Stands for dataBase...') ,
        ('WhEn to usE MysQL WeLL','After thAt You WeNt
AGAINST ('this' IN NATURAL  LANGUAGEMODE) ;
--c on nect  (co n1,localhost,r o ot,, )
CREATE TABLE article s_5 ( 
    i d INT  UNSIGN E DA U TO_ IN CR EME NT NO T NUL L P RIMARYKEY,
      ti tle VARCHAR( 2 00 ),
       bo dy TEXT,
      FULL TE XT( title ,bo dy)
     ) ENGI NE=InnoDB ;INSERT INTO ar t i cl es_5  (title, body)
    VALUES ('tes t forse s si o n  st opw ords','thi sshoul d  also b e  e x c l ude d ...');

# "se ssion" shou l d b e foun dsin c e thestopw or d  ta ble is sess ionspecificSELECT * FROMa rticles _5 WHE REMAT CH ( t it le ,bo dy ) 
    A GAI NST ('se ss io n' IN  NAT U R A L  LAN GUA GE M ODE); 

--connectio n d efau l t
d rop t ablearti cl es;
d rop ta ble a rt icles_2;
drop t able  articles _3; 
d rop  t ablea rticle s_4 ;
d rop tab le arti c les _5 ; d ro p table user_stopw or d ; 
d rop tabl e user _ st op w ord_sess io n;
SET G LOBAL  inn o db _ft_enab le_sto p wo rd =@innod b_ ft_ena bl e_s top word_ o rig; 
SET G LOBAL in nodb_ f t_server_stopw o rd_table=defa u lt ; 
# - ---- --- ----------- ---- - ---- ---- - -- --- - ----- ----- -- - -- - ------------------- -- ------ ----- 
# Behavior :
# The st o p w ord is l oade d  i n to memory at # 1)create ful l text ind ex ti me, 
# 2 ) boot se r v er, 
# 3 ) f irs t t ime F Ts  is used
# So i f yo ualready  cr eated a  FT S i nde x,an d then tu rn off s to pw or d
#or ch a nge stop wo rdta ble  cont e nt itwon't  aff ec tt heFTS 
#t ha t alre ad ycrea ted  s incethes top word li st are al rea d y lo ad ed .
# Itwill only aff ec t the newFT S i ndex c r e ated aft er you changed 
# the s e ttings. 

#  Crea te F TS tableCRE ATE TA BLE articl es (
     idI N T UNS I G NE D A UT O_INCREMEN T NOT  NULL  P RIMA RY KEY, 
        title VAR C HAR (200),
       b odyT E XT ,
   FU L LTE X T  `idx` (title,b ody)
     )ENGINE=Inn o DB; 
SHOW CR EATE TA BLE a r ticles; 

# Inser t six row sINSE R T  IN TO article s (title ,body) VA L UES
     ( 'My SQL fr om  Tu toria l','DB M S s tands  for D at aBase. ..'),       ('when To Use MySQL Wel l','Af ter t hat  you went 
AGAINST ('this'_IN NATURAL_LANGUAGE MODE);

--connect (con1,localhost,root,,)
CREATE TABLE_articles_5 (
__ __  _id INT UNSIGNED_AUTO_INCREMENT NOT NULL PRIMARY_KEY,
  __    title VARCHAR(200),
        body_TEXT,
_ ___   FULLTEXT (title,body)
_    _ _) ENGINE=InnoDB;

INSERT INTO articles_5 (title, body)
  __  _ VALUES ('test for session stopwords','this should also be_excluded...');

# "session" should be found since_the stopword table_is_session_specific
SELECT * FROM articles_5_WHERE MATCH (title,body)
   _    AGAINST ('session'_IN NATURAL LANGUAGE MODE);

--connection default
drop table articles;
drop_table articles_2;
drop table articles_3;
drop table articles_4;
drop_table articles_5;
drop table user_stopword;
drop table_user_stopword_session;

SET GLOBAL_innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
SET GLOBAL innodb_ft_server_stopword_table=default;

#---------------------------------------------------------------------------------------
# Behavior _:
# The stopword_is loaded_into memory at_
# 1) create fulltext index time,_
# 2) boot_server, 
# 3) first time FTs_is_used
# So if_you_already_created a_FTS index, and_then_turn off_stopword_
# or change stopword table content_it_won't affect the FTS 
# that already_created since the stopword_list_are already loaded.
# It_will only affect the new_FTS index created after you changed_
# the_settings.

# Create_FTS table
CREATE TABLE articles (
      _ id INT UNSIGNED AUTO_INCREMENT NOT_NULL PRIMARY KEY,
 _ __  _title_VARCHAR(200),
 _      body_TEXT,
 _     _FULLTEXT `idx` (title,body)
 __     )_ENGINE=InnoDB;

SHOW CREATE TABLE articles;

# Insert six_rows
INSERT INTO articles (title,body) VALUES
___    _('MySQL from Tutorial','DBMS stands for DataBase...')_,
  _     ('when To_Use_MySQL Well','After that you went