Reputation: 6820
so I am trying to make a simple search engine, that allows a user to search username, email, firstname and lastname.
However everytime I run the following it only returns russell.harrower instead of both russellharrower and russell.harrower
SELECT *, MATCH(username) AGAINST ('russell') as score FROM
user_infoWHERE MATCH(username) AGAINST ('russell')
I am not sure if i need to put a like status in there or what, so thought i would ask.
I want it to order the whole sql by the score.
Upvotes: 0
Views: 598
Reputation: 125
Did you try using asterisk (wildcard) in boolean mode?
[...] AGAINST ('+russell*' IN BOOLEAN MODE)
http://dev.mysql.com/doc/refman/5.5/en/fulltext-boolean.html
http://www.joedolson.com/boolean-query-in-mysql.php
/edit: don't use LIKE, especially with % in front of a phrase, it's veeery slow
Upvotes: 1