大多數搜索引擎orloyded網站使用FULL-TEXT-SEARCH
。 這將是非常快比較select
和LIKE
... 我增加了一個例子,一些鏈接... 我認爲這將是對你有用... 在此全文搜索有一定的條件下也.. 。
STEP:1
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
);
STEP:2
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');
STEP:3
自然語言全文搜索:
SELECT * FROM articles
WHERE MATCH (title,body) AGAINST ('database');
布爾全文搜索
SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
通過這個鏈接 viralpatel.net,devzone.zend.com,sqlmag.com, colorado.edu,en.wikipedia.org