views:

37

answers:

1
+1  Q: 

Search MySQL Query

I have the below Code

SELECT * FROM table WHERE MATCH(message) AGAINST ('Hello*')

If the message string is like this

"HelloWhatsHappening"

It dosent Work return anything

But if i have

"Hello WhatsHappening"

It works fine

It will also work if the string is as such:

"Hello= WhatsHappening"

Any Ideas?

+2  A: 

You need to specify your query with a wild card, and add the "IN BOOLEAN MODE" statement. Like this:

SELECT * FROM table WHERE MATCH(message) AGAINST ('Hello*'  IN BOOLEAN MODE)

You also might have troubles searching for hello, because it is one of the stop words in MySQL. So it doesn't index the word if it is just hello, but it will index it if it's the word "HelloWhatsHappening".

Kibbee
ooo im sorry.. i forgot that in the question.. Its Already doing That :(
Shahmir Javaid
I added the IN BOOLEAN MODE. But it dont work
Shahmir Javaid
Wait i think ima twonk :D... in my table the Hello is stored as such "Hello:" but is there a reason why that dont work
Shahmir Javaid
It will interpret Hello: as Hello, because the : is not a word character. As such, it will not Index Hello: as it is a stop word.
Kibbee