For Example, I'm search for a person with the last name of Ash
so in my query I search for Ash
. It will show me people with the last name of Ashley, Ashby etc... but not people with the exact last name of Ash
Here's an example of what my sql looks like:
SELECT * FROM `People`
WHERE MATCH(PersonFirstName, PersonLastName) AGAINST('ash*' IN BOOLEAN MODE) LIMIT 20
Is there some sort of rule that it has to be over 3 characters or something in order for MATCH AGAINST to find it?
It could be this using the SUBSTR function in MySQL: SELECT `name` FROM `students` WHERE `marks` > 75 ORDER BY SUBSTR(`name`, -3), ID ASC; SUBSTR(name, -3) will select the last three characters in the name column of the student table.
To check if a name begins ends with a vowel we use the string functions to pick the first and last characters and check if they were matching with vowels using in where the condition of the query. We use the LEFT() and RIGHT() functions of the string in SQL to check the first and last characters.
A SQL extension that lets you screen large amounts of historical data in search of event patterns, the MATCH clause provides subclasses for analytic partitioning and ordering and matches rows from the result table based on a pattern you define.
See the system variable ft_min_word_len, which specifies the minimum length of words to be indexed by full-text searching. It defaults to 4, so 3-letter words won't be found by full-text searching. More information about parameters of full-text searching can be found at 12.9.6. Fine-Tuning MySQL Full-Text Search. That page explains:
For example, if you want three-character words to be searchable, you can set the ft_min_word_len variable by putting the following lines in an option file:
[mysqld]
ft_min_word_len=3
Then restart the server and rebuild your FULLTEXT indexes. Note particularly the remarks regarding myisamchk in the instructions following this list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With