+ Reply to Thread
Results 1 to 5 of 5

Thread: Full text search returns an empty string, can't understand

  1. #1
    oliflorence is offline Coder oliflorence will become famous soon enough
    Join Date
    Jan 2007
    Location
    Navan, Co Meath
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Full text search returns an empty string, can't understand

    Hello,
    I have an sql search with data in a table which should be returned. However the I am getting an empty set back.
    I enclose below the SQL I am using and the table:

    Code:
    SELECT poisonId, poison, latin_name, short_desc, status FROM tblpoisons WHERE MATCH (poison,latin_name,short_desc,full_desc) AGAINST ('%poison%')
    
    Here is the table:
    Code:
    CREATE TABLE `tblpoisons` ( `poisonId` int(11) NOT NULL auto_increment, `catId` int(11) default NULL, `poison` varchar(150) default NULL, `latin_name` varchar(150) default NULL, `short_desc` varchar(250) default NULL, `Full_desc` mediumtext, `status` tinyint(1) default NULL, PRIMARY KEY (`poisonId`), FULLTEXT KEY `searchindex` (`poison`,`latin_name`,`short_desc`,`Full_desc`)) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
    Many thanks

  2. #2
    Briask's Avatar
    Briask is offline Wannabe Geek Briask will become famous soon enough
    Join Date
    Feb 2008
    Location
    Dublin
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Have you inserted any data in the table?

    The SQL you included creates an empty table.

  3. #3
    oliflorence is offline Coder oliflorence will become famous soon enough
    Join Date
    Jan 2007
    Location
    Navan, Co Meath
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes there is data added, it should return some data as the word searched is included in the fields

  4. #4
    ziycon's Avatar
    ziycon is offline Wannabe Geek ziycon will become famous soon enough
    Join Date
    Jan 2007
    Location
    Dublin
    Posts
    461
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Maybe try a LIKE statement??

  5. #5
    Briask's Avatar
    Briask is offline Wannabe Geek Briask will become famous soon enough
    Join Date
    Feb 2008
    Location
    Dublin
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You need to add more rows to the table or change the query.

    MySQl has a 50% threshold on the Match Against construct meaning that if your query matches more than 50% of the rows in the table it does not consider the match relevant so it does not return the rows.

    So you add more rows without the text you are querying for and you'll get results ...

    Or you can use the "In boolean mode" by changing your query to
    Code:
    SELECT poisonId, poison, latin_name, short_desc, status 
    FROM tblpoisons
    WHERE MATCH (poison,latin_name,short_desc,full_desc) 
    AGAINST ('%poison%' in boolean mode)
    

+ Reply to Thread

Visitors found this page by searching for:

Nobody landed on this page from a search engine, yet!
SEO Blog

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

Search Engine Optimization by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64