2

I've been loking into Mysql's Match Against search. The results are strange. For example, if I have a table attribute with an entry "education" and do a search (using match against) for "edu" then it finds it. But if i search for "educ" no results are returned. All the way up to "educatio" does not return results. So it only matches whole words, or if 3 letters or less match in a word.

Is there a way to improve it so that results are returned when a search term is a subset of a word in the attribute? E.g. using the example above, searching "educat" would return rows containing "Education"

user1716672
  • 1,073
  • 2
  • 20
  • 44

2 Answers2

0

You can do exactly what you want by matching IN BOOLEAN MODE and using the * operator.

For example:

 ... MATCH(thing) AGAINST ('+educat*' IN BOOLEAN MODE)...

The + tells the match to include only the values of thing that contain the match term, which in this case is all indexed values beginning with "educat" (see here for how Boolean mode works in detail).

As an aside, Fulltext search in MySQL does not index words of 3 or fewer characters by default, so I suspect your match with "edu" is not working the way you think. Look at the value of your ft_min_word_len variable to see if that's the case.

Jeremy Smyth
  • 23,270
  • 2
  • 52
  • 65
0

you can use the mark %a (a=your word or letter)that search any word that start with the same word or letter you can use %a% that search part of the word that the start and/or in the middle of the word and the last one you can use a% that ends with the word or letter

Erez S
  • 1
  • 2