Problam in Full Text Search
-- Insert stopwords (for simplicity, a single stopword is used in this example)
mysql> INSERT INTO my_stopwords(value) VALUES ('want');
Query OK, 1 row affected (0.00 sec)
-- Create the table
mysql> CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
phrase TEXT(500)
) ENGINE=InnoDB;
-- Insert data into the table
mysql> INSERT INTO t1(phrase) VALUES
('I want Iphone 6s about');
-- Set the innodb_ft_server_stopword_table option to the new stopword table
mysql> SET GLOBAL innodb_ft_server_stopword_table = 'test/my_stopwords';
Query OK, 0 rows affected (0.00 sec)
-- Create the full-text index (which rebuilds the table if no FTS_DOC_ID column is defined)
mysql> CREATE FULLTEXT INDEX idx ON t1(phrase);
mysql> SELECT * FROM t1 WHERE MATCH (phrase) AGAINST ('Iphone' IN NATURAL LANGUAGE MODE);
+----+------------------------+
| id | phrase |
+----+------------------------+
| 1 | I want Iphone 6s about |
+----+------------------------+
1 row in set (0.00 sec)
mysql> SELECT * FROM t1 WHERE MATCH (phrase) AGAINST ('want' IN NATURAL LANGUAGE MODE);
Empty set (0.00 sec)
Till this It works good.
After this I add 'Iphone' in my_stopwords table.
then I run bellow query, and I get result. 'Iphone' is same as 'want', Bellow query should not return any result but it returns.
SELECT * FROM t1 WHERE MATCH (phrase) AGAINST ('Iphone' IN NATURAL LANGUAGE MODE);
Is there any mistake.
I wanted like this. Any search word from 'my_stopwords' table should not return any result.
Subject
Views
Written By
Posted
Problam in Full Text Search
2805
February 27, 2016 02:55AM
1403
March 06, 2016 11:07PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.