Irish SEO,  Marketing & Webmaster Discussion
 

 

Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help


Notices

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 14-04-2008, 10:32 AM
Frontpage User
 
Join Date: Jan 2007
Location: Navan, Co Meath
Posts: 26
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
oliflorence will become famous soon enough
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 14-04-2008, 10:58 AM
Briask's Avatar
Coder
 
Join Date: Feb 2008
Location: D'Office
Posts: 66
Nominated 1 Time in 1 Post
TOTW/F/M Award(s): 0
Briask will become famous soon enough
Default

Have you inserted any data in the table?

The SQL you included creates an empty table.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 14-04-2008, 11:46 AM
Frontpage User
 
Join Date: Jan 2007
Location: Navan, Co Meath
Posts: 26
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
oliflorence will become famous soon enough
Default

Yes there is data added, it should return some data as the word searched is included in the fields
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 14-04-2008, 12:05 PM
ziycon's Avatar
Wannabe Geek
Recent Blog: Life with Playstation
 
Join Date: Jan 2007
Location: Dublin
Posts: 363
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ziycon will become famous soon enough
Send a message via MSN to ziycon
Default

Maybe try a LIKE statement??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 14-04-2008, 12:37 PM
Briask's Avatar
Coder
 
Join Date: Feb 2008
Location: D'Office
Posts: 66
Nominated 1 Time in 1 Post
TOTW/F/M Award(s): 0
Briask will become famous soon enough
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 05:05 AM.


Powered by: vBulletin Version 3.7.2, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.

Search Engine Friendly URLs by vBSEO 3.2.0