views:

31

answers:

2

I have a simple MySQL table that is setup for full text search.

| id | title         |
----------------------
| 1  | test event    |
| 2  | Second test   |
| 3  | Larry's event |
| 4  | this second   |

When I use the query:

SELECT * 
FROM EVENTS
WHERE MATCH (title) AGAINST ('test event' IN BOOLEAN MODE);

I get back 3 rows; the ones containing 'test event', 'Second test', and 'Larry's Event'.

Now If I run the following query:

SELECT * 
FROM EVENTS
WHERE MATCH (title) AGAINST ('second' IN BOOLEAN MODE);

Nothing is returned... strange?

Lastly, if I run the query:

SELECT * 
FROM EVENTS
WHERE MATCH (title) AGAINST ('second test' IN BOOLEAN MODE);

I get back 2 rows; the ones containing 'test event' and 'Second test'.

I appears that the word 'second' cannot be searched or needs to be escaped somehow. Am I missing something?

+1  A: 

Yes, second is a stop word & will be ingored. (You can override this behaviour)

Alex K.
+1  A: 

Yup, it's a stopword:

Fulltext stopwords

if you have access to the mySQL server, you can change the stopword list file as described here. If it's a shared server, you may be out of luck.

Pekka