ghghghgh
ghghghgh

Reputation: 13

Full text search with php

I do not get any results for the following query:

"SELECT * FROM test2 WHERE MATCH(txt) AGAINST('hello' IN BOOLEAN MODE)"

while test2 looks like:

id | txt
 1 | ...
 2 | ...
 3 | ...
 4 | ...
.. | ...

txt is 30 characters long (TEXT) and fulltext. I have about 16 records (tiny db) and the word hello is placed almost in every record in txt along with other words. I just wanted to know how full-text search works. So i get zero results and I can't understand why.

Upvotes: 1

Views: 358

Answers (1)

Eljakim
Eljakim

Reputation: 6937

there are two reasons that you are not getting any results:

Reason 1: your search word 'hello' occurs in too many rows.

A natural language search interprets the search string as a phrase in natural human language (a phrase in free text). There are no special operators. The stopword list applies. In addition, words that are present in 50% or more of the rows are considered common and do not match. Full-text searches are natural language searches if no modifier is given.

Source: http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html

Reason 2: your search word 'hello' is on the stop-word list. Any word on the stopword list will never match!

Source: http://dev.mysql.com/doc/refman/5.1/en/fulltext-stopwords.html

Upvotes: 2

Related Questions