SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2005
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Anyway to change ft_min_word_len?

    Is there a way to somehow change the ft_min_word_len for Mysql using PHP? I made a search form that searches a database. The problem is there are a lot of 3 letter words that will never show up in a search because of this restriction.

    If it can't be changed is there a way to add an invisible character to it in Mysql or something to bump it up to 4 characters? I'm on a Shared host, so asking them to change it for isn't gonna happen, and there is no my.cnf file to edit.

  2. #2
    SitePoint Enthusiast niardica's Avatar
    Join Date
    Sep 2002
    Location
    CA
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you want people to be able to search for three letter words?

  3. #3
    SitePoint Guru
    Join Date
    Aug 2003
    Location
    CT
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    4 chars is the limitation of full text search. if you want to go to shorter strings, you need to turn off FTS and end up using much more processor time

  4. #4
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    925
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    I have also found the max 4 chars very limiting for searches. I believe there should be a simple way built in mysql to choose how many characters should be considered in a search. I was building a site with photographic equipment so with the limit of 4 chars, the full text search was virtually useless since most people would search for names of products which consist of very short "words" - even 2- or 1-characters or digits. So I developed a solution: the php script which indexed pages for search was prepending (with a regular expression function) the right amount of underscore characters to each word, so that all indexed words were at least 3-characters long (the limit on my server was 3). Because mysql treats "_" as a word character I could easily search for 2-letter words - for example when searching for "DG", my query searched for "_DG". And I used IN BOOLEAN MODE to get rid of other limitations. Ugly solution but worked.

    Currently I'm rebuilding the search engine without the FT search because I need more control over the search functionality and I need search for 1-character words too. Personally, I wonder who finds the standard FT search useful, I would never built a search engine based on that since people wouldn't find anything they want.

  5. #5
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You do realize that allowing search for smaller and smaller words, particularly 1 character words, will slow your query down significantly as your data grows and will almost always ignore indexes, which means you will have to search all records in your table instead of ones that start with 'S' for instance when searching for Smith?

  6. #6
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    925
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    I do realize the search for smaller words will slow down queries but nevertheless I think this should be an option for full text search. I NEED this functionality on my site so if I can't do it with fulltext I will do it another way, which is by means of several tables to store indexed pages. And I'm sure that if mysql provided an easy way to search for smaller words it would be much quicker to use fulltext instead of all kinds of workarounds like the ones I mentioned above. Slowing down queries is not the right explanation for the limitation - it is up to the web developer to decide if he wants more speed or smaller words. Some sites really need search engines for smaller words. Imagine google had a 4-character per word limit - it would never become the quality search engine like it is now.

  7. #7
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    you can adjust the 4 character limit, but it requires that you edit the my.ini or my.cnf file, restart mysql, then rebuild your indexes. read the FULLTEXT section of the manual.

    or even better, do a search in the forum since many people have asked this question many times.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •