How to Change MySQL FULLTEXT Index Minimum and Maximum Length of Words如何更改MySQL的全文索引的最小和最大長度的詞

MySQL database has built-in full-text search capability that allows SQL queries to perform search quickly using MySQL database engine. MySQL數據庫有內置的全文檢索功能,使SQL查詢執行搜尋快速使用MySQL數據庫引擎。 The full-text search capability depends on the FULLTEXT index which is been created on various table fields or columns.全文搜索能力取決於全文指數是已經建立的各種表字段或列。 However, some search queries may not return the experted results or datasets, even though the data is verified to exists on full-text search, especially on short keywords or search terms.然而,一些搜索查詢可能不會返回experted結果或數據,即使數據是核實存在於全文檢索,特別是對短期的關鍵字或搜索字詞。

The problem probably lies on the default minimum length of words indexed by FULLTEXT index which is set as 4 characters.這個問題可能在於默認最小長度的話收錄全文指數設定為4個字符。 Thus, when attempting to search via full-text index, the short words are not indexed, and hance not return in search results.因此,當試圖通過搜索全文索引,短期的話沒有索引,和碟子不返回搜索結果。

By default, the minimum value for length of word to be indexed in FULLTEXT index is four characters, while the default maximum length of words to be indexed in FULLTEXT index is varies depending on version of mySQL server.默認情況下,最低值為長度的詞索引的全文索引是四個字符,而默認的最大長度的話要建立索引的全文索引是根據不同版本的MySQL服務器。 To increase the number of words indexed and searchable, especially shorter words such as three-character words, administrator can reduce the minimum or increase the maximum length of words to be indexed by using ft_min_word_len and ft_max_word_len system variables.為了增加關鍵詞索引和搜索,尤其是短的詞語,如3個字符的話,管理員可以減少或增加的最低的最大長度的詞的索引使用ft_min_word_len和ft_max_word_len系統變量。

For example, for FULLTEXT index to index the three-character words, or 3-letter text, add in the following line to set the lower value for ft_min_word_len variable under [mysqld] section to an option file, ie my.cnf:舉例來說,全文索引,以指數的三個字符的話,或3個字母文字中添加下面一行設置較低的價值ft_min_word_len變量下[ mysqld ]部分的選項文件,即my.cnf :

[mysqld]
ft_min_word_len=3

Save the file, and then restart the MySQL server.保存該文件,然後重新啟動MySQL服務器。 After changing either value of full-text variable, which both affects indexing, the FULLTEXT indexes must be rebuilt.在不斷變化的價值,要么全文變量,這兩個影響索引,全文索引必須重建。 The following command to do a quick repair operating is sufficient to rebuild the indexes:下面的命令,做一個快速修復操作系統足以重建索引:

mysql> REPAIR TABLE tbl_name QUICK; MySQL的“ 快速修復表tbl_name ;

Note that each and every table that contains any FULLTEXT index must be repaired with SQL command above.請注意,每一個表,其中包含任何全文索引必須修復SQL命令以上。 Also do not use myisamchk (unless you have also defined the full-text parameter values in [myisamchk] section) to perform the rebuilt as the full-text parameters are only known to mysqld server.也沒有使用myisamchk (除非您還界定全文參數值在[ myisamchk ]節)執行重建作為全文參數只知道mysqld服務器。 If rebuild is not done, queries for the table may yield incorrect results, and modifications to the table will cause the server to see the table as corrupt and in need of repair.如果重建不這樣做,查詢的表可能會產生不正確的結果,並修改該表將導致服務器看到桌上的腐敗和需要修理。

IMPORTANT : You're reading a machine translated page which is provided "as is" without warranty. 重要說明 :您正在閱讀的機器翻譯網頁是“按原樣”提供的保證。 Unlike human translation, machine translation does not understand the grammar, semantics, syntax, idioms of natural language, thus often produce inaccurate and low quality text which is misleading and incomprehensible.不同於人工翻譯,機器翻譯不明白的語法,語義,句法,成語自然語言,因此,往往產生不準確的和低質量的文字這是誤導性的和不可理解的。 Thus, please refer to因此,請參閱 original English article英文原版的文章 when in doubt.如有疑問。



2 Responses to “How to Change MySQL FULLTEXT Index Minimum and Maximum Length of Words” 2回應“如何更改MySQL的全文索引的最小和最大長度的詞”

  1. admin管理員
    May 11th, 2008 08:21 08年5月11日08:21
    2 2

    Depends.視情況而定。 Normally it's located in /etc通常它位於在/ etc

  2. chichilatte chichilatte
    May 11th, 2008 02:49 08年5月11日02:49
    1 1

    Yes, thnks, but where is this mysterious config file “my.cnf”?是的, thnks ,但這個神秘的配置文件“ my.cnf ” ?

Leave a Reply留下回复

必填

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 您可以使用這些標籤:<a href="" title=""> <abbr title=""> <acronym title=""><b> <blockquote cite=""> <cite><code> “刪除日期時間= “ ” “<em><i> <q cite=""> <strike><strong>

Subscribe to comments feature has been disabled. 訂閱評論功能已被禁用。 To receive notification of latest comments posted, subscribe to 收到通知後的最新評論,訂閱 Tip and Trick Comments RSS feed 提示引誘評論RSS飼料 or register to receive 註冊接收 new comments in daily email digest. 新評論的電子郵件每天消化。
Custom Search

Incoming Search Terms for the Article收到的搜索字詞的文章

mysql rebuild fulltext index MySQL的重建全文索引 - - mysql fulltext index MySQL的全文索引 - - rebuild fulltext index mysql 重建全文索引的MySQL - - mysql rebuild index MySQL的重建指數 - - mysql minimum word length MySQL的最低字長 - - mysql update fulltext index MySQL的更新全文索引 - - mysql rebuild FULLTEXT indexes MySQL的重建全文索引 - - mysql rebuild fulltext MySQL的重建全文 - - rebuild fulltext indexes MySQL 重建全文索引的MySQL - - fulltext index mysql 全文索引的MySQL - - mysql minimum length MySQL的最小長度 - - mysql index rebuild MySQL的索引重建 - - mysql rebuild full text index MySQL的重建全文索引 - - mysql fulltext index length MySQL的全文索引長度 - - rebuild index MYSQL 重建索引數據庫 - - rebuild fulltext mysql 重建全文數據庫 - - mysql text index length MySQL的文字索引長度 - - rebuild mysql fulltext index 重建的MySQL全文索引 - - search 搜索 - - mysql fulltext MySQL的全文 - - minimum word length fulltext 最低字長全文 - - mysql fulltext minimum characters MySQL的全文最小字符 - - wm6 mysql wm6的MySQL - - mysql change index length MySQL變更指數長度 - - mysql fulltext length MySQL的全文長度 - - length mysql 長度的MySQL - - mysql fulltext ft_min_word_len - - change mysql fulltext length 更改MySQL的全文長度 - - mysql full text keyword length MySQL的全文關鍵字長度 - - all 全部 - - fulltext min chars 全文民字 - - ft_min_word_len change ft_min_word_len變化 - - fulltext search minimum length 全文搜索的最小長度 - - mysql change search minimum length MySQL變更搜索最小長度 - - minimum and maximum word length full-text parameters 最低和最高字長全文參數 - - mysql fulltext minimum word length MySQL的全文最低字長 - - fulltext mysql 全文數據庫 - - how to rebuild FULLTEXT index MySQL 如何重建全文索引的MySQL - - fulltext length 全文長度 - - mysql minimum search 3 chars help MySQL的最低搜尋3 chars已幫助 - - mysql full text search 3 chars MySQL的全文檢索3個字符 - - full text index mysql 3 letter words 全文索引MySQL的3字母詞 - - update fulltext index mysql 更新全文索引的MySQL - - mysql 3 letter fulltext MySQL的3信全文 - - mysql full text search minimum length 3 MySQL的全文檢索的最小長度3 - - mysql maximum indexes MySQL的最高指數 - - mySQL full text search 3 letter words MySQL的全文檢索3字母詞 - - how to change minimum word length for full text search in mysql 如何改變最低字長的全文檢索在MySQL - - set mysql full text search minimum word length 設置MySQL的全文檢索最低字長 - - mysql full text search min length MySQL的全文檢索分鐘長度 - -