MySQL Forums
Forum List  »  MyISAM

Re: FullText problem 'start with' or 'end with'
Posted by: Rick James
Date: September 10, 2014 06:40PM

FULLTEXT works with "starts with", but not "ends with". However you can use a "regular expression" to look for words that end with something:
mysql> SELECT city FROM us WHERE city RLIKE 'rey[[:>:]]' limit 11;
+---------------+
| city          |
+---------------+
| Monterey      |
| Monterey Park |
| Godfrey       |
| Jaffrey       |
+---------------+
http://dev.mysql.com/doc/refman/5.5/en/regexp.html

You can put the two together with OR.

Which of these do you want to find?
workout
The solution works out.
workingout
It is a workout
Working is a problem.

That is, are you talking about start/end of word? or of field?
Are you limiting to a single word that has both "work*" and "*out"?
mysql> SELECT city FROM us WHERE city RLIKE '[[:<:]]M[[:alpha:]]*y[[:>:]]' limit 11;
| Monterey           |
| Monterey Park      |
| Lake Mary          |
| Machesney Park     |
...

RLIKE is slower than LIKE, which is much slower than MATCH. But if you RLIKE is the only way, you gotta use it.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: FullText problem 'start with' or 'end with'
1581
September 10, 2014 06:40PM


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.