| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> mysql >> shi yi zuo jian dan sou suo de MySQL shu ju ku quan wen suo yin

shi yi zuo jian dan sou suo de MySQL shu ju ku quan wen suo yin

2008-07-10 05:54:06 编辑來源:互联网 评论
 
 
 
本文为【适宜做简单搜索的MySQL数据库全文索引】的拼音翻译版
  quan wen suo yin zai MySQL zhong shi yi ge FULLTEXT lei xing suo yin 。FULLTEXT suo yin yong yu MyISAM biao , ke yi zai CREATE TABLE shi huo zhi hou shi yong ALTER TABLE huo CREATE INDEX zai CHAR、VARCHAR huo TEXT lie shang chuang jian 。 dui yu da de shu ju ku , jiang shu ju zhuang zai dao yi ge mei you FULLTEXT suo yin de biao zhong , ran hou zai shi yong ALTER TABLE ( huo CREATE INDEX) chuang jian suo yin , zhe jiang shi fei chang kuai de 。 jiang shu ju zhuang zai dao yi ge yi jing you FULLTEXT suo yin de biao zhong , jiang shi fei chang man de 。
  quan wen sou suo tong guo MATCH() han shu wan cheng :
  mysql> CREATE TABLE articles (
  -> id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
  -> title VARCHAR(200),
  -> body TEXT,
  -> FULLTEXT (title,body)
  -> );
  Query OK, 0 rows affected (0.00 sec)
  mysql> INSERT INTO articles VALUES
  -> (NULL,'MySQL Tutorial', 'DBMS stands for DataBase ...'),
  -> (NULL,'How To Use MySQL Efficiently', 'After you went through a ...'),
  -> (NULL,'Optimising MySQL','In this tutorial we will show ...'),
  -> (NULL,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
  -> (NULL,'MySQL vs. YourSQL', 'In the following database comparison ...'),
  -> (NULL,'MySQL Security', 'When configured properly, MySQL ...');
  Query OK, 6 rows affected (0.00 sec)
  Records: 6 Duplicates: 0 Warnings: 0
  mysql> SELECT * FROM articles
  -> WHERE MATCH (title,body) AGAINST ('database');
  +----+-------------------+------------------------------------------+
  | id | title | body |
  +----+-------------------+------------------------------------------+
  | 5 | MySQL vs. YourSQL | In the following database comparison ... |
  | 1 | MySQL Tutorial | DBMS stands for DataBase ... |
  +----+-------------------+------------------------------------------+
  2 rows in set (0.00 sec)
  han shu MATCH() dui zhao yi ge wen ben ji ( bao han zai yi ge FULLTEXT suo yin zhong de yi ge huo duo ge lie de lie ji ) zhi xing yi ge zi ran yu yan sou suo yi ge zi fu chuan 。 sou suo zi fu chuan zuo wei AGAINST() de shen shu bei gei ding 。 sou suo yi hu lue zi mu da xiao xie de fang shi zhi xing 。 dui yu biao zhong de mei ge ji lu xing ,MATCH() fan hui yi ge xiang guan xing zhi 。 ji , zai sou suo zi fu chuan yu ji lu xing zai MATCH() lie biao zhong zhi ding de lie de wen ben zhi jian de xiang si xing chi du 。
  dang MATCH() bei shi yong zai yi ge WHERE zi ju zhong shi ( shen kan shang mian de li zi ), fan hui de ji lu xing bei zi dong di yi xiang guan xing cong gao dao di de ci xu pai xu 。 xiang guan xing zhi shi fei fu de fu dian shu zi 。 ling xiang guan xing yi wei zhe bu xiang si 。 xiang guan xing de ji suan shi ji yu : ci zai ji lu xing zhong de shu mu 、 zai xing zhong wei yi ci de shu mu 、 zai ji zhong ci de quan bu shu mu he bao han yi ge te shu ci de wen dang ( ji lu xing ) de shu mu 。
  ta ye ke yi zhi xing yi ge luo ji mo shi de sou suo 。 zhe zai xia mian de zhang jie zhong bei miao shu 。
  qian mian de li zi shi han shu MATCH() shi yong shang de yi xie ji ben shuo ming 。 ji lu xing yi xiang si xing di jian de shun xu fan hui 。 xia yi ge shi li xian shi ru he jian suo yi ge ming que de xiang si xing zhi 。 ru guo ji mei you WHERE ye mei you ORDER BY zi ju , fan hui xing shi bu pai xu de 。
  mysql> SELECT id,MATCH (title,body) AGAINST ('Tutorial') FROM articles;
  +----+-----------------------------------------+
  | id | MATCH (title,body) AGAINST ('Tutorial') |
  +----+-----------------------------------------+
  | 1 | 0.64840710366884 |
  | 2 | 0 |
  | 3 | 0.66266459031789 |
  | 4 | 0 |
  | 5 | 0 |
  | 6 | 0 |
  +----+-----------------------------------------+
  6 rows in set (0.00 sec)
  xia mian de shi li geng fu duo yi dian 。 cha xun fan hui xiang si xing bing yi ran yi xiang si du di jian de ci xu fan hui ji lu xing 。 wei le wan cheng zhe ge jie guo , ni ying gai zhi ding MATCH() liang ci 。 zhe bu hui yin qi fu jia de kai xiao , yin wei MySQL you hua qi hui zhu yi dao liang ci tong yang de MATCH() tiao yong , bing zhi tiao yong yi ci quan wen sou suo dai ma 。
  mysql> SELECT id, body, MATCH (title,body) AGAINST
  -> ('Security implications of running MySQL as root') AS score
  -> FROM articles WHERE MATCH (title,body) AGAINST
  -> ('Security implications of running MySQL as root');
  +----+-------------------------------------+-----------------+
  | id | body | score |
  +----+-------------------------------------+-----------------+
  | 4 | 1. Never run mysqld as root. 2. ... | 1.5055546709332 |
  | 6 | When configured properly, MySQL ... | 1.31140957288 |
  +----+-------------------------------------+-----------------+
  2 rows in set (0.00 sec)
  MySQL shi yong yi ge fei chang jian dan de pou xi qi lai jiang wen ben fen ge cheng ci 。 yi ge “ ci ” shi you wen zi 、 shu ju 、“'” he “_” zu cheng de ren he zi fu xu lie 。 ren he zai stopword lie biao shang chu xian de , huo tai duan de (3 ge zi fu huo geng shao de ) de “word” jiang bei hu lue 。
  zai ji he cha xun zhong de mei ge he shi de ci gen ju qi zai ji yu cha xun zhong de chong yao xing heng liang 。 zhe yang , yi ge chu xian zai duo ge wen dang zhong de ci jiang you jiao di de quan chong ( ke neng shen zhi you yi ge ling quan chong ), yin wei zai zhe ge te ding de ji zhong , ta you jiao di de yu yi zhi 。 fou ze , ru guo ci shi jiao shao de , ta jiang de dao yi ge jiao gao de quan chong 。 ran hou , ci de quan chong jiang bei jie he yong yu ji suan ji lu xing de xiang si xing 。
  zhe yang yi ge ji shu gong zuo ke hen hao di gong zuo yu da de ji ( shi ji shang , ta hui xiao xin di yu zhi xie tiao )。 dui yu fei chang xiao de biao , ci fen lei bu zu yi chong fen di fan ying ta men de yu yi zhi , you shi zhe ge mo shi ke neng chan sheng qi guai de jie guo 。
  mysql> SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('MySQL');
  Empty set (0.00 sec)
  zai shang mian de li zi zhong , sou suo ci MySQL que mei you de dao ren he jie guo , yin wei zhe ge ci zai chao guo yi ban de ji lu xing zhong chu xian 。 tong yang de , ta bei you xiao di chu li wei yi ge stopword ( ji , yi ge ling yu yi zhi de ci )。 zhe shi zui li xiang de xing wei -- yi ge zi ran yu yan de cha xun bu ying gai cong yi ge 1GB de biao zhong fan hui mei ge ci xing (second row)。
  pi pei biao zhong yi ban ji lu xing de ci hen shao ke neng zhao dao xiang guan wen dang 。 shi ji shang , ta ke neng hui fa xian xu duo bu xiang guan de wen dang 。 wo men dou zhi dao , dang wo men zai hu lian wang shang tong guo sou suo yin qing shi tu sou suo mou xie dong xi shi , zhe hui jing chang fa sheng 。 yin wei zhe ge yuan yin , zai zhe ge te shu de shu ju ji zhong , zhe yang de xing bei she zhi yi ge di de yu yi zhi 。
  dao 4.0.1 shi ,MySQL ye ke yi shi yong IN BOOLEAN MODE xiu shi yu lai zhi xing yi ge luo ji quan wen sou suo 。
  mysql> SELECT * FROM articles WHERE MATCH (title,body)
  -> AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
  +----+------------------------------+-------------------------------------+
  | id | title | body |
  +----+------------------------------+-------------------------------------+
  | 1 | MySQL Tutorial | DBMS stands for DataBase ... |
  | 2 | How To Use MySQL Efficiently | After you went through a ... |
  | 3 | Optimising MySQL | In this tutorial we will show ... |
  | 4 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ... |
  | 6 | MySQL Security | When configured properly, MySQL ... |
  +----+------------------------------+-------------------------------------+
  
  
  zhe ge cha xun fan hui suo you bao han ci MySQL de ji lu xing ( zhu yi : 50% de yu zhi mei you shi yong ), dan shi ta mei you bao han ci YourSQL。 zhu yi , yi ge luo ji mo shi de sou suo bu hui zi dong di yi xiang si zhi de jiang xu pai xu ji lu xing 。 ni ke yi cong shang mian de jie guo chu kan de chu lai , zui gao de xiang si zhi ( bao han MySQL liang ci de na ge ) zui lie zai zui hou , er bu shi di yi wei 。 yi ge luo ji quan wen sou suo ji shi zai mei you yi ge FULLTEXT suo yin de qing kuang xia ye ke yi gong zuo , ran er ta man xie 。
  luo ji quan wen sou suo zhi chi xia mian de cao zuo fu :“+” yi ge ling tou de jia hao biao shi , gai ci bi xu chu xian zai mei ge fan hui de ji lu xing zhong ,“-” yi ge ling tou de jian hao biao shi , gai ci bi xu bu chu xian zai mei ge fan hui de ji lu xing zhong 。
  que sheng de ( dang ji mei you jia hao ye mei you fu hao bei zhi ding shi ) ci shi sui yi de , dan shi bao han ta de ji lu xing jiang bei pai lie di geng gao yi dian 。 zhe ge mo fang mei you IN BOLEAN MODE xiu shi ci de MATCH() ... AGAINST() de xing wei 。
  < > zhe liang ge cao zuo fu yong yu gai bian yi ge ci de xiang si xing zhi de ji zhi 。< cao zuo fu jian shao ji zhi ,> cao zuo fu ze zeng jia ta 。 shen kan xia mian de shi li 。
  ( ) yuan kuo hao yong yu dui zi biao da shi zhong de ci fen zu 。
  ~ yi ge ling tou de fou ding hao de zuo yong xiang yi ge fou ding cao zuo fu , yin qi xing xiang si xing de ci de ji zhi wei fu de 。 ta dui biao ji yi ge zao sheng ci hen you yong 。 yi ge bao han zhe yang de ci de ji lu jiang bei pai lie de di yi dian , dan shi bu hui bei wan quan de pai chu , yin wei zhe yang ke yi shi yong - cao zuo fu 。
  * yi ge xing hao shi jie duan cao zuo fu 。 bu xiang qi ta de cao zuo fu , ta ying gai bei zhui jia dao yi ge ci hou , bu jia zai qian mian 。
  " duan yu , bei bao wei zai shuang yin hao " zhong , zhi pi pei bao han zhe ge duan yu ( zi mian shang de , jiu hao xiang bei jian ru de ) de ji lu xing 。
  zhe li shi yi xie shi li :
  apple banana
  zhao zhi shao bao han shang mian ci zhong de yi ge de ji lu xing
  1.+apple +juice ... liang ge ci yun zai bei bao han
  2.+apple macintosh ... bao han ci “apple”, dan shi ru guo tong shi bao han “macintosh”, ta de pai lie jiang geng gao yi xie
  3.+apple -macintosh ... bao han “apple” dan bu bao han “macintosh”
  4.+apple +(>pie 5.apple* ... bao han “apple”,“apples”,“applesauce” he “applet”
  6."some words" ... ke yi bao han “some words of wisdom”, dan bu shi “some noise words”
  quan wen de xian zhi
  * MATCH() han shu de suo you shen shu bi xu shi cong lai zi yu tong yi zhang biao de lie , tong shi bi xu shi tong yi ge FULLTEXT suo yin zhong de yi bu fen , chu fei MATCH() shi IN BOOLEAN MODE de 。
  * MATCH() lie lie biao bi xu que qie di pi pei biao de mou yi FULLTEXT suo yin zhong ding yi de lie lie biao , chu fei MATCH() shi IN BOOLEAN MODE de 。
  * AGAINST() de shen shu bi xu shi yi ge chang liang zi fu chuan 。
  wei tiao MySQL quan wen sou suo
  bu xing di , quan wen sou suo reng ran zhi you hen shao de yong hu ke tiao shen shu , sui ran zeng jia yi xie zai TODO shang pai lie hen gao 。 ru guo ni you yi ge MySQL yuan ma fa xing ( cha kan zhang jie 2.3 an zhuang yi ge MySQL yuan ma fa xing ), ni ke yi fa hui dui quan wen sou suo de geng duo kong zhi 。
  zhu yi , quan wen sou suo wei zui jia de sou suo xiao guo , bei zai xi di tiao zheng le 。 xiu gai mo ren zhi de xing wei , zai da duo shu qing kuang xia , zhi hui shi sou suo jie guo geng zao 。 bu yao xiu gai MySQL de yuan dai ma , chu fei ni zhi dao ni zai zuo shen me !
  * bei suo yin de ci de zui xiao chang du you MySQL bian liang ft_min_word_len zhi ding 。 cha kan zhang jie 4.5.6.4 SHOW VARIABLES。 jiang ta gai wei ni suo xi wang de zhi , bing chong jian ni de FULLTEXT suo yin 。 ( zhe ge bian liang zhi cong MySQL 4.0 kai shi bei zhi chi )
  * stopword lie biao ke yi cong ft_stopword_file bian liang zhi ding de wen jian zhong du qu 。 cha kan zhang jie 4.5.6.4 SHOW VARIABLES。 zai xiu gai le stopword lie biao hou , chong jian ni de FULLTEXT suo yin 。( zhe ge bian liang zhi cong MySQL 4.0.10 kai shi bei zhi chi )
  * 50% yu zhi xuan ze you suo xuan ze de te shu de heng liang mo shi que ding 。 wei le jin zhi ta , xiu gai `myisam/ftdefs.h' wen jian zhong xia mian de yi xing :
  #define GWS_IN_USE GWS_PROB
  gai wei :
  #define GWS_IN_USE GWS_FREQ
  ran hou chong xin bian yi MySQL。 zai zhe zhong qing kuang xia , bu xu yao chong jian suo yin 。 zhu yi : shi yong le zhe ge , jiang yan chong di jian shao MySQL wei MATCH() ti gong zu gou de xiang si xing zhi de neng li 。 ru guo ni que shi xu yao sou suo zhe yang de gong gong ci , zui hao shi yong IN BOOLEAN MODE de sou suo dai ti , ta bu zun shou 50% de yu zhi 。
  * you shi , sou suo yin qing wei hu yuan xi wang geng gai shi yong yu luo ji quan wen sou suo de cao zuo fu 。 zhe xie you bian liang ft_boolean_syntax ding yi 。 ran er , zhe ge bian liang shi zhi du de , ta de zhi zai `myisam/ft_static.c' zhong bei she zhi 。
  dui yu zhe xie geng gai , yao qiu ni chong jian ni de FULLTEXT suo yin , dui yu yi ge MyISAM biao , zui rong yi de chong jian suo yin wen jian de fang shi ru xia mian de yu ju :
  mysql> REPAIR TABLE tbl_name QUICK;
  quan wen sou suo TODO * shi suo you dui FULLTEXT suo yin de cao zuo geng kuai
  * lin jin (Proximity) cao zuo fu
  * dui "always-index words" de zhi chi 。 ta men ke yi shi yong hu xi wang shi wei yi ge ci chu li de ren yi zi fu chuan , li ru "C++"、"AS/400"、"TCP/IP", deng deng
  * zhi chi zai MERGE biao zhong de quan wen sou suo
  * dui duo zi jie zi fu de zhi chi
  * yi zhao shu ju de yu yan jian li stopword lie biao
  * Stemming ( dang ran , yi lai yu shu ju de yu yan )
  * Generic user-suppliable UDF preparser.
  * shi mo shi geng jia ling huo ( tong guo wei CREATE/ALTER TABLE zhong de FULLTEXT zeng jia mou xie ke tiao zheng shen shu )【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
quan wen suo yin zai MySQL zhong shi yi ge FULLTEXT lei xing suo yin 。FULLTEXT suo yin yong yu MyISAM biao , ke yi zai CREATE TABLE shi huo zhi hou shi yong ALTER TABLE huo CREATE INDEX zai CHAR、VARCHAR huo TEXT lie shang chuang jian 。 dui yu da de shu ju ku , jiang shu ju zhuang zai dao yi ge mei you FULLTEXT suo yin de biao zhong , ran hou zai shi yong ALTER TABLE ( huo CREATE INDEX) chuang jian suo yin , zhe jiang shi fei chang kuai de 。 jiang shu ju zhuang zai dao yi ge yi jing you FULLTEXT suo yin de biao zhong , jiang shi fei chang man de 。 quan wen sou suo tong guo MATCH() han shu wan cheng : mysql> CREATE TABLE articles ( -> id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, -> title VARCHAR(200), -> body TEXT, -> FULLTEXT (title,body) -> ); Query OK, 0 rows affected (0.00 sec) mysql> INSERT INTO articles VALUES -> (NULL,'MySQL Tutorial', 'DBMS stands for DataBase ...'), -> (NULL,'How To Use MySQL Efficiently', 'After you went through a ...'), -> (NULL,'Optimising MySQL','In this tutorial we will show ...'), -> (NULL,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), -> (NULL,'MySQL vs. YourSQL', 'In the following database comparison ...'), -> (NULL,'MySQL Security', 'When configured properly, MySQL ...'); Query OK, 6 rows affected (0.00 sec) Records: 6 Duplicates: 0 Warnings: 0 mysql> SELECT * FROM articles -> WHERE MATCH (title,body) AGAINST ('database'); +----+-------------------+------------------------------------------+ | id | title | body | +----+-------------------+------------------------------------------+ | 5 | MySQL vs. YourSQL | In the following database comparison ... | | 1 | MySQL Tutorial | DBMS stands for DataBase ... | +----+-------------------+------------------------------------------+ 2 rows in set (0.00 sec) han shu MATCH() dui zhao yi ge wen ben ji ( bao han zai yi ge FULLTEXT suo yin zhong de yi ge huo duo ge lie de lie ji ) zhi xing yi ge zi ran yu yan sou suo yi ge zi fu chuan 。 sou suo zi fu chuan zuo wei AGAINST() de shen shu bei gei ding 。 sou suo yi hu lue zi mu da xiao xie de fang shi zhi xing 。 dui yu biao zhong de mei ge ji lu xing ,MATCH() fan hui yi ge xiang guan xing zhi 。 ji , zai sou suo zi fu chuan yu ji lu xing zai MATCH() lie biao zhong zhi ding de lie de wen ben zhi jian de xiang si xing chi du 。 dang MATCH() bei shi yong zai yi ge WHERE zi ju zhong shi ( shen kan shang mian de li zi ), fan hui de ji lu xing bei zi dong di yi xiang guan xing cong gao dao di de ci xu pai xu 。 xiang guan xing zhi shi fei fu de fu dian shu zi 。 ling xiang guan xing yi wei zhe bu xiang si 。 xiang guan xing de ji suan shi ji yu : ci zai ji lu xing zhong de shu mu 、 zai xing zhong wei yi ci de shu mu 、 zai ji zhong ci de quan bu shu mu he bao han yi ge te shu ci de wen dang ( ji lu xing ) de shu mu 。 ta ye ke yi zhi xing yi ge luo ji mo shi de sou suo 。 zhe zai xia mian de zhang jie zhong bei miao shu 。 qian mian de li zi shi han shu MATCH() shi yong shang de yi xie ji ben shuo ming 。 ji lu xing yi xiang si xing di jian de shun xu fan hui 。 xia yi ge shi li xian shi ru he jian suo yi ge ming que de xiang si xing zhi 。 ru guo ji mei you WHERE ye mei you ORDER BY zi ju , fan hui xing shi bu pai xu de 。 mysql> SELECT id,MATCH (title,body) AGAINST ('Tutorial') FROM articles; +----+-----------------------------------------+ | id | MATCH (title,body) AGAINST ('Tutorial') | +----+-----------------------------------------+ | 1 | 0.64840710366884 | | 2 | 0 | | 3 | 0.66266459031789 | | 4 | 0 | | 5 | 0 | | 6 | 0 | +----+-----------------------------------------+ 6 rows in set (0.00 sec) xia mian de shi li geng fu duo yi dian 。 cha xun fan hui xiang si xing bing yi ran yi xiang si du di jian de ci xu fan hui ji lu xing 。 wei le wan cheng zhe ge jie guo , ni ying gai zhi ding MATCH() liang ci 。 zhe bu hui yin qi fu jia de kai xiao , yin wei MySQL you hua qi hui zhu yi dao liang ci tong yang de MATCH() tiao yong , bing zhi tiao yong yi ci quan wen sou suo dai ma 。 mysql> SELECT id, body, MATCH (title,body) AGAINST -> ('Security implications of running MySQL as root') AS score -> FROM articles WHERE MATCH (title,body) AGAINST -> ('Security implications of running MySQL as root'); +----+-------------------------------------+-----------------+ | id | body | score | +----+-------------------------------------+-----------------+ | 4 | 1. Never run mysqld as root. 2. ... | 1.5055546709332 | | 6 | When configured properly, MySQL ... | 1.31140957288 | +----+-------------------------------------+-----------------+ 2 rows in set (0.00 sec) MySQL shi yong yi ge fei chang jian dan de pou xi qi lai jiang wen ben fen ge cheng ci 。 yi ge “ ci ” shi you wen zi 、 shu ju 、“'” he “_” zu cheng de ren he zi fu xu lie 。 ren he zai stopword lie biao shang chu xian de , huo tai duan de (3 ge zi fu huo geng shao de ) de “word” jiang bei hu lue 。 zai ji he cha xun zhong de mei ge he shi de ci gen ju qi zai ji yu cha xun zhong de chong yao xing heng liang 。 zhe yang , yi ge chu xian zai duo ge wen dang zhong de ci jiang you jiao di de quan chong ( ke neng shen zhi you yi ge ling quan chong ), yin wei zai zhe ge te ding de ji zhong , ta you jiao di de yu yi zhi 。 fou ze , ru guo ci shi jiao shao de , ta jiang de dao yi ge jiao gao de quan chong 。 ran hou , ci de quan chong jiang bei jie he yong yu ji suan ji lu xing de xiang si xing 。 zhe yang yi ge ji shu gong zuo ke hen hao di gong zuo yu da de ji ( shi ji shang , ta hui xiao xin di yu zhi xie tiao )。 dui yu fei chang xiao de biao , ci fen lei bu zu yi chong fen di fan ying ta men de yu yi zhi , you shi zhe ge mo shi ke neng chan sheng qi guai de jie guo 。 mysql> SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('MySQL'); Empty set (0.00 sec) zai shang mian de li zi zhong , sou suo ci MySQL que mei you de dao ren he jie guo , yin wei zhe ge ci zai chao guo yi ban de ji lu xing zhong chu xian 。 tong yang de , ta bei you xiao di chu li wei yi ge stopword ( ji , yi ge ling yu yi zhi de ci )。 zhe shi zui li xiang de xing wei -- yi ge zi ran yu yan de cha xun bu ying gai cong yi ge 1GB de biao zhong fan hui mei ge ci xing (second row)。 pi pei biao zhong yi ban ji lu xing de ci hen shao ke neng zhao dao xiang guan wen dang 。 shi ji shang , ta ke neng hui fa xian xu duo bu xiang guan de wen dang 。 wo men dou zhi dao , dang wo men zai hu lian wang shang tong guo sou suo yin qing shi tu sou suo mou xie dong xi shi , zhe hui jing chang fa sheng 。 yin wei zhe ge yuan yin , zai zhe ge te shu de shu ju ji zhong , zhe yang de xing bei she zhi yi ge di de yu yi zhi 。 dao 4.0.1 shi ,MySQL ye ke yi shi yong IN BOOLEAN MODE xiu shi yu lai zhi xing yi ge luo ji quan wen sou suo 。 mysql> SELECT * FROM articles WHERE MATCH (title,body) -> AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +----+------------------------------+-------------------------------------+ | id | title | body | +----+------------------------------+-------------------------------------+ | 1 | MySQL Tutorial | DBMS stands for DataBase ... | | 2 | How To Use MySQL Efficiently | After you went through a ... | | 3 | Optimising MySQL | In this tutorial we will show ... | | 4 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ... | | 6 | MySQL Security | When configured properly, MySQL ... | +----+------------------------------+-------------------------------------+ zhe ge cha xun fan hui suo you bao han ci MySQL de ji lu xing ( zhu yi : 50% de yu zhi mei you shi yong ), dan shi ta mei you bao han ci YourSQL。 zhu yi , yi ge luo ji mo shi de sou suo bu hui zi dong di yi xiang si zhi de jiang xu pai xu ji lu xing 。 ni ke yi cong shang mian de jie guo chu kan de chu lai , zui gao de xiang si zhi ( bao han MySQL liang ci de na ge ) zui lie zai zui hou , er bu shi di yi wei 。 yi ge luo ji quan wen sou suo ji shi zai mei you yi ge FULLTEXT suo yin de qing kuang xia ye ke yi gong zuo , ran er ta man xie 。 luo ji quan wen sou suo zhi chi xia mian de cao zuo fu :“+” yi ge ling tou de jia hao biao shi , gai ci bi xu chu xian zai mei ge fan hui de ji lu xing zhong ,“-” yi ge ling tou de jian hao biao shi , gai ci bi xu bu chu xian zai mei ge fan hui de ji lu xing zhong 。 que sheng de ( dang ji mei you jia hao ye mei you fu hao bei zhi ding shi ) ci shi sui yi de , dan shi bao han ta de ji lu xing jiang bei pai lie di geng gao yi dian 。 zhe ge mo fang mei you IN BOLEAN MODE xiu shi ci de MATCH() ... AGAINST() de xing wei 。 < > zhe liang ge cao zuo fu yong yu gai bian yi ge ci de xiang si xing zhi de ji zhi 。< cao zuo fu jian shao ji zhi ,> cao zuo fu ze zeng jia ta 。 shen kan xia mian de shi li 。 ( ) yuan kuo hao yong yu dui zi biao da shi zhong de ci fen zu 。 ~ yi ge ling tou de fou ding hao de zuo yong xiang yi ge fou ding cao zuo fu , yin qi xing xiang si xing de ci de ji zhi wei fu de 。 ta dui biao ji yi ge zao sheng ci hen you yong 。 yi ge bao han zhe yang de ci de ji lu jiang bei pai lie de di yi dian , dan shi bu hui bei wan quan de pai chu , yin wei zhe yang ke yi shi yong - cao zuo fu 。 * yi ge xing hao shi jie duan cao zuo fu 。 bu xiang qi ta de cao zuo fu , ta ying gai bei zhui jia dao yi ge ci hou , bu jia zai qian mian 。 " duan yu , bei bao wei zai shuang yin hao " zhong , zhi pi pei bao han zhe ge duan yu ( zi mian shang de , jiu hao xiang bei jian ru de ) de ji lu xing 。 zhe li shi yi xie shi li : apple banana zhao zhi shao bao han shang mian ci zhong de yi ge de ji lu xing 1.+apple +juice ... liang ge ci yun zai bei bao han 2.+apple macintosh ... bao han ci “apple”, dan shi ru guo tong shi bao han “macintosh”, ta de pai lie jiang geng gao yi xie 3.+apple -macintosh ... bao han “apple” dan bu bao han “macintosh” 4.+apple +(>pie 5.apple* ... bao han “apple”,“apples”,“applesauce” he “applet” 6."some words" ... ke yi bao han “some words of wisdom”, dan bu shi “some noise words” quan wen de xian zhi * MATCH() han shu de suo you shen shu bi xu shi cong lai zi yu tong yi zhang biao de lie , tong shi bi xu shi tong yi ge FULLTEXT suo yin zhong de yi bu fen , chu fei MATCH() shi IN BOOLEAN MODE de 。 * MATCH() lie lie biao bi xu que qie di pi pei biao de mou yi FULLTEXT suo yin zhong ding yi de lie lie biao , chu fei MATCH() shi IN BOOLEAN MODE de 。 * AGAINST() de shen shu bi xu shi yi ge chang liang zi fu chuan 。 wei tiao MySQL quan wen sou suo bu xing di , quan wen sou suo reng ran zhi you hen shao de yong hu ke tiao shen shu , sui ran zeng jia yi xie zai TODO shang pai lie hen gao 。 ru guo ni you yi ge MySQL yuan ma fa xing ( cha kan zhang jie 2.3 an zhuang yi ge MySQL yuan ma fa xing ), ni ke yi fa hui dui quan wen sou suo de geng duo kong zhi 。 zhu yi , quan wen sou suo wei zui jia de sou suo xiao guo , bei zai xi di tiao zheng le 。 xiu gai mo ren zhi de xing wei , zai da duo shu qing kuang xia , zhi hui shi sou suo jie guo geng zao 。 bu yao xiu gai MySQL de yuan dai ma , chu fei ni zhi dao ni zai zuo shen me ! * bei suo yin de ci de zui xiao chang du you MySQL bian liang ft_min_word_len zhi ding 。 cha kan zhang jie 4.5.6.4 SHOW VARIABLES。 jiang ta gai wei ni suo xi wang de zhi , bing chong jian ni de FULLTEXT suo yin 。 ( zhe ge bian liang zhi cong MySQL 4.0 kai shi bei zhi chi ) * stopword lie biao ke yi cong ft_stopword_file bian liang zhi ding de wen jian zhong du qu 。 cha kan zhang jie 4.5.6.4 SHOW VARIABLES。 zai xiu gai le stopword lie biao hou , chong jian ni de FULLTEXT suo yin 。( zhe ge bian liang zhi cong MySQL 4.0.10 kai shi bei zhi chi ) * 50% yu zhi xuan ze you suo xuan ze de te shu de heng liang mo shi que ding 。 wei le jin zhi ta , xiu gai `myisam/ftdefs.h' wen jian zhong xia mian de yi xing : #define GWS_IN_USE GWS_PROB gai wei : #define GWS_IN_USE GWS_FREQ ran hou chong xin bian yi MySQL。 zai zhe zhong qing kuang xia , bu xu yao chong jian suo yin 。 zhu yi : shi yong le zhe ge , jiang yan chong di jian shao MySQL wei MATCH() ti gong zu gou de xiang si xing zhi de neng li 。 ru guo ni que shi xu yao sou suo zhe yang de gong gong ci , zui hao shi yong IN BOOLEAN MODE de sou suo dai ti , ta bu zun shou 50% de yu zhi 。 * you shi , sou suo yin qing wei hu yuan xi wang geng gai shi yong yu luo ji quan wen sou suo de cao zuo fu 。 zhe xie you bian liang ft_boolean_syntax ding yi 。 ran er , zhe ge bian liang shi zhi du de , ta de zhi zai `myisam/ft_static.c' zhong bei she zhi 。 dui yu zhe xie geng gai , yao qiu ni chong jian ni de FULLTEXT suo yin , dui yu yi ge MyISAM biao , zui rong yi de chong jian suo yin wen jian de fang shi ru xia mian de yu ju : mysql> REPAIR TABLE tbl_name QUICK; quan wen sou suo TODO * shi suo you dui FULLTEXT suo yin de cao zuo geng kuai * lin jin (Proximity) cao zuo fu * dui "always-index words" de zhi chi 。 ta men ke yi shi yong hu xi wang shi wei yi ge ci chu li de ren yi zi fu chuan , li ru "C++"、"AS/400"、"TCP/IP", deng deng * zhi chi zai MERGE biao zhong de quan wen sou suo * dui duo zi jie zi fu de zhi chi * yi zhao shu ju de yu yan jian li stopword lie biao * Stemming ( dang ran , yi lai yu shu ju de yu yan ) * Generic user-suppliable UDF preparser. * shi mo shi geng jia ling huo ( tong guo wei CREATE/ALTER TABLE zhong de FULLTEXT zeng jia mou xie ke tiao zheng shen shu )
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
时尚秀气模特裴裴(8)
时尚秀气模特裴裴(7)
时尚秀气模特裴裴(6)
时尚秀气模特裴裴(5)
白墙黑瓦
广州东郊[原创]
八美至丹巴的东谷天然盆景
不一样的
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有