www.webdeveloper.com
Results 1 to 5 of 5

Thread: Use of match against with strings shorter than 4 characters

  1. #1
    Join Date
    May 2011
    Location
    Paris
    Posts
    4

    Question Use of match against with strings shorter than 4 characters

    Hello,

    I am using MySQL queries based on "match against" for internal search engine. There is a full text index inside the database.

    I like "match against" because results can be ordered by relevancy.

    However, I see 2 cons :

    - Strings shorter than 4 characters are ignored when requested
    - Simple quotes (the " ' ") inside the database cause some disturbings in my case : words placed just before and after the quote are not considered as single words. Which means the data "... developer's ..." won't match with the query "developer".

    Do you know any way to fix these 2 cons, especially the first one ?
    Maybe I should use another type of syntax ?

    Thank you

  2. #2
    Join Date
    May 2011
    Posts
    25
    you have to change the internal setting of mysql to achieve a shorter search string.
    in my.cnf you have to add:

    PHP Code:
    [mysqld]
    ft_min_word_len=
    restart mysql with perhaps:

    PHP Code:
    /etc/init.d/mysql restart 
    And rebuild your mysql fulltext index in mysql with:

    PHP Code:
    repair table <table

  3. #3
    Join Date
    May 2011
    Location
    Paris
    Posts
    4
    Thank you for your reply.

    Does it mean it will "break" all de fulltext index of the database ?

  4. #4
    Join Date
    May 2011
    Posts
    25
    yes you need to repair ALL the tables holding a fulltext index.
    repair table <table> quick
    should work as well.

  5. #5
    Join Date
    May 2011
    Location
    Paris
    Posts
    4
    OK, thank you for your help.
    Since it may lead to side effects, I will ask the host admin to proceed.

    By the way, do you have any solutions to force MySQL to consider simple quotes as word separators ?
    Last edited by BillTrankill; 05-26-2011 at 03:27 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles