+ Reply to Thread
Results 1 to 4 of 4

Thread: MySQL query sometimes worsks

  1. #1
    wjh2303 is offline x10 Sophmore wjh2303 is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    139

    MySQL query sometimes worsks

    I have a small table with about 20 entries, each entry has a cell containing a set of tags, made searchable by the FULLTEXT command thingy, so that i can search by tag using MATCH() AGAINST().

    However, when i search by tag, some of them seem to work, and others not, i.e when i search for the tag 'city' it returns all the entries tagged city correctly, but when i seach for another tag, 'arch' for example, i get no results, when there are definately some rows with that tag. This happens both on a php page and through phpmyadmin.

    Any ideas? help appreciated! thanks.

  2. #2
    akkudreamz's Avatar
    akkudreamz is offline x10 Sophmore akkudreamz is an unknown quantity at this point
    Join Date
    Jan 2009
    Location
    Jaipur, Rajasthan, India
    Posts
    183

    Re: MySQL query sometimes worsks

    Code:
    A few restrictions affect MySQL FULLTEXT indices. Some of the default behaviors of these restrictions can be changed in your my.cnf or using the SET command. 
    FULLTEXT indices are NOT supported in InnoDB tables.
    MySQL requires that you have at least three rows of data in your result set before it will return any results.
    By default, if a search term appears in more than 50% of the rows then MySQL will not return any results. 
    By default, your search query must be at least four characters long and may not exceed 254 characters.
    MySQL has a default stopwords file that has a list of common words (i.e., the, that, has) which are not returned in your search. In other words, searching for the will return zero rows.
    According to MySQL's manual, the argument to AGAINST() must be a constant string. In other words, you cannot search for values returned within the query.
    Be safety conscious. 80% of people are caused by accidents.
    My Weblog

  3. #3
    wjh2303 is offline x10 Sophmore wjh2303 is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    139

    Re: MySQL query sometimes worsks

    that looks helpfull, ill try and work on some of the aspects mentioned there, may i ask your source incase it is usefull in furture?
    Edit:
    Thanks, thats working now, some of the tags were too short, so i lengthened them and that worked, and one of the tags was in over 50% of the rows, so adding some empty filler rows so they were less than 50% solved that
    Last edited by wjh2303; 03-23-2009 at 12:29 PM. Reason: Automerged Doublepost

  4. #4
    wjh2303 is offline x10 Sophmore wjh2303 is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    139

    Re: MySQL query sometimes worsks

    For future reference, i have just figured that a work-around for the 50% limit in the fulltext search is to do the search in boolean mode:

    http://dev.mysql.com/doc/refman/5.1/...t-boolean.html

+ Reply to Thread

Similar Threads

  1. [PHP] MySQL and PHP
    By Bryon in forum Tutorials
    Replies: 43
    Last Post: 03-24-2011, 07:27 AM
  2. Replies: 14
    Last Post: 09-29-2008, 07:07 PM
  3. New Site-Suggestions?
    By mnoutside in forum Review My Site
    Replies: 9
    Last Post: 08-27-2008, 07:01 AM
  4. Replies: 9
    Last Post: 01-10-2008, 03:16 AM
  5. Have a problem with my forum
    By tikloos in forum Scripts & 3rd Party Apps
    Replies: 43
    Last Post: 01-19-2006, 01:14 AM

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
x10hosting free hosting for the masses
dedicated servers