0

For pset8's search function I would like to change the min-char length used by MATCH AGAINST to 3.

I found this link on dev.mysql.com which explains how to change the min_word_len system variable:

[mysqld]
ft_min_word_len=3

It seems like I have to do this from the Terminal - but I don't know how and didn't found any helpful resources online.

Could someone help me with this and point me in the right direction?

2
2

This post sounds like it might be what you are looking for Match TWO letters with SQL query

cd to /etc/mysql/conf.d and create a file with extension .cnf (e.g. user_sett.cnf) that looks like this:

[mysqld]
ft_min_word_len=2

and save. Restart the server by rebooting the appliance and that should do it.

I had a problem with permissions on /etc/mysql/conf.d directory. You could try this approach.

  • In gedit, create the file as described and save it in your home directory.
  • From a terminal window, copy it to /etc/mysql/conf.d using
    sudo cp user_sett.cnf /etc/mysql/conf.d.
  • Restart the server as described.
6
  • Thx for the link, your input was valuable furthermore! I had to rebuild the FULLTEXT index so that it took effect. But, only "los" like in "los angeles" and "los alamos" is working :-/ "New" like in "new york" isn't matching anything... Do you have an input on how to solve this? Are there any other places with three letters?
    – Lex
    Dec 4 '15 at 18:41
  • 1
    Top of mind is San.....I find the los's, the new's, the san's. But they don't show up first in the dropdown. There are probably too many differences between our indexes, our queries, etc to make a comparison. The first match I get for new is Newagen, ME. Now for some unsolicited, free (as in "you get what you pay for") advice. If you are getting results from typeahead, move on to the next challenge. In my experience, this is not the most difficult part of the pset. Dec 4 '15 at 19:13
  • 1
    San works. However your right, it's time to move on. Just a last question: I'm using FULLTEXT Index with MATCH in boolean mode - that way I only can find full words like Newagen, something like Newag wouldn't match anything, even typeahead nor wildcards (*, %) doesn't fill or match. So, are you using MATCH with some special wildcards or modes OR are you using LIKE with its % wildcard, so that you can fill New...?
    – Lex
    Dec 5 '15 at 10:20
  • My FT index is place_name, admin_code1, postal_code. My query is "MATCH (place_name, admin_code1, postal_code) AGAINST (? IN BOOLEAN MODE)". ? is replaced by $_GET['geo']. My ft_min_word_len is 2 (so it will match on state abbreviation). Newag finds/matches Newagen. Dec 5 '15 at 14:34
  • OOPS, pants on fire! ? is replaced by $_GET['geo']."*" (adding * wildcard to end of 'geo'). Dec 5 '15 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .