我在尝试对 mysql 中的表执行全文搜索时遇到问题。相关表具有以下创建命令:
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('')
无论 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')
或者我知道在那里的任何单词或短语(任何长度,任何单词)......但它仍然返回一个空集。 我知道这一定是我错过的一些简单的东西,但我不知道它可能是什么。
最佳答案
什么话?您知道,有些词不被视为“the”或“how”,这些词通常看起来很有意义。那么单词必须有最小长度。
最后!
In addition, words that are present in 50% or more of the rows are considered common and do not match.
我敢打赌这里就是这种情况。了解更多相关信息here.
关于mysql - 全文搜索返回空结果时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13490017/