2

I'm in trouble with a strange behavior of mysql. If I try to search with fulltext query sam* word, I have no results back.

Ex. table companies

    id || name
    1  || Company name
    2  || Same Company name

If I make

`SELECT name FROM companies WHERE MATCH name AGAINST ('+Company*' IN BOOLEAN MODE)`

It works, instead if I use

`SELECT name FROM companies WHERE MATCH name AGAINST ('+Sam*' IN BOOLEAN MODE)`

or

`SELECT name FROM companies WHERE MATCH name AGAINST ('+Same' IN BOOLEAN MODE)`

I have no results!

Do you have any idea about this issue?

PS. if I use +Sa* instead of +Sam*, it works

2
  • Hi I also have same issue with word "NVR". did you find any solution for this issue please let me know. Commented May 9, 2016 at 17:05
  • I recommend reading this : hackingwithphp.com/9/3/18/… It really help ! Commented Aug 25, 2020 at 14:10

1 Answer 1

0

You must to change the configuration value ft_min_word_len (fulltext min word length) the default value is set to 4.

Add (or modify) this line to mysql config /etc/my.cnf (or my.ini in windows)

ft_min_word_len = 3

After that you may call the index re-creation using the command:

REPAIR TABLE companies QUICK;

BTW: Fulltext search doesn't accept LIKE wildcards: * or %

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.