我遇到了尝试在mysql中对表执行全文搜索的问题。有问题的表具有以下create命令:
CREATE TABLE IF NOT EXISTS `resume_contents`
(`resumeid` int(100) NOT NULL AUTO_INCREMENT,
`jobseekerid` varchar(255) NOT NULL,
`resumecontents` text,
PRIMARY KEY (`resumeid`),
UNIQUE KEY `jobseekerid` (`jobseekerid`),
FULLTEXT KEY `resumecontents` (`resumecontents`) )
ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
所以基本上只有3列,只有一列的全文。然后,当我尝试使用以下命令进行全文搜索时:
SELECT * FROM `resume_contents` WHERE MATCH (resumecontents) AGAINST('')
每次都得到一个空结果集,无论反对子句中有什么单词。我在这里犯了什么愚蠢的错误?
作为一个例子,我正在测试一行,它有来自resume.com的简历样本。
INSERT INTO `resume_contents` (`resumeid`, `jobseekerid`, `resumecontents`) VALUES (2, '14', 'Objectives\nI am looking for a position at This Company where I can maximize my programming skills, project management, leadership skills, and create new and exciting tools.\n\n\nSummary\nI have had 3 years experience in web design and development. I am fimilar with a lot of the languages and software used in creating projects for the web. Futhermore, I have great project management skills and also work well either alone or with a group. I have also worked on small projects and large public releases for large companies.\n\n\nEducation\nDesign Media \nCollege Humor, Seattle, WA\nGraduated: January 2008 \nGrade: College\n\nEmployment History\nDecember 2007 – Present: Web Designer \nCompany: ComStream\nSeattle, Washington\nWorked as team lead on many different client projects.\n\n\nProfessional Skills\nAdobe Photoshop – Expert\n\nAdobe Illustrator – Expert\n\nAdobe Dreamweaver – Advanced\n\nPhp – Advanced\n\n\nQualification/Certification\nJanuary 2006: New Media Design \nOrganization: School of Technology\nAward: \nSan Fransico\nLanguages\nCzech – Beginner\n\nVietnamese – Conversational\n\n\nImmigration / Work Status\nDecember 2041 – Permanent Resident - United States');
然后我搜索:
SELECT * FROM `resume_contents` WHERE MATCH(`resumecontents`) AGAINST ('Company')
或者我知道的任何单词或短语(任何长度,任何单词)都在那里......然而它仍然会返回一个空集。 我知道它一定是简单的我想念但我不知道它会是什么。
答案 0 :(得分:1)
用什么词?你知道,某些词语不被视为“the”或“how”,这些词语似乎经常是有意义的。然后单词必须具有最小长度。
最后!
此外,50%或更多行中出现的单词被认为是常见的并且不匹配。
我打赌这就是这种情况。详细了解here.