我在早期版本的Wamp Server(2.5)中成功使用了以下查询,直到升级到3.0版。
此查询在实际服务器上正常工作,但在本地服务器上失败。我认为表可能有问题,因此将所有实际的服务器表导入到本地服务器但仍无效。
我非常确定所有索引都存在&所有表都使用MyISAM引擎。
索引列表:
1)uk.Keyword_Name in e_pj_keywords uk table
2)a.company_name& post_jobs中的a.company_type表
3)位置j表中的j.location_name
我已经使用过stackoverflow&的所有问题的参考资料。谷歌解决这个错误,但不能。
还为所有相关表启用了KEYS,但没有任何效果。
Can't find FULLTEXT index matching the column list
我知道会有非常小的错误但无法捕捉到它。请帮助。
以下是我的查询
SELECT SQL_CALC_FOUND_ROWS
*
FROM
(SELECT
a.job_id,
a.Employer_ID,
a.Sub_user_id,
DATE_FORMAT(a.creation_on, '%d-%m-%Y') AS Created_date,
DATEDIFF(CURDATE(), MAX(a.creation_on)) AS Posted_days,
a.Job_type,
a.Designation,
a.Open_Positions,
a.Job_Description,
a.Min_age,
a.Max_age,
a.min_exp,
a.max_exp,
a.Hide_Salary,
a.company_name,
a.company_type,
a.About_Company,
a.Contact_person_name,
a.Contact_No,
a.Refresh_type,
a.Response_type,
a.Job_status,
DATEDIFF(CURDATE(), MAX(a.creation_on)) AS Days_last_Login,
(SELECT GROUP_CONCAT(DISTINCT g.Education ORDER BY pjedu.Education_ID SEPARATOR ', ') user_education
FROM e_pj_edu pjedu INNER JOIN education g ON FIND_IN_SET(g.Edu_ID, pjedu.Education_ID)
WHERE a.job_id = pjedu.Job_ID LIMIT 1
) AS Education,
(SELECT GROUP_CONCAT(DISTINCT h.FA_description ORDER BY uf.FA_ID SEPARATOR ', ') FA
FROM e_pj_fa uf INNER JOIN functional_area h ON FIND_IN_SET(h.FA_ID, uf.FA_ID)
WHERE a.Job_ID = uf.Job_ID LIMIT 1
) AS FA_description,
(SELECT GROUP_CONCAT(DISTINCT i.Industry_description ORDER BY ui.Industry_ID SEPARATOR ', ') Industry_ID
FROM e_pj_industry ui INNER JOIN industry i ON FIND_IN_SET(i.Industry_ID, ui.Industry_ID)
WHERE a.Job_ID = ui.Job_ID LIMIT 1
) AS Industry_description,
(SELECT GROUP_CONCAT(DISTINCT j.location_name ORDER BY upl.Location_ID SEPARATOR ', ') Location_ID
FROM e_pj_locations upl INNER JOIN locations j ON FIND_IN_SET(j.location_id, upl.Location_ID)
WHERE a.Job_ID = upl.Job_ID LIMIT 1
) AS location_name,
(SELECT GROUP_CONCAT(DISTINCT uk.Keyword_Name ORDER BY uk.Keyword_ID SEPARATOR ', ') keyskills
FROM e_pj_keywords uk WHERE a.Job_ID = uk.Job_ID LIMIT 1
) AS Keyword_Name,
GROUP_CONCAT(DISTINCT cc.salary_description ORDER BY cc.salary_ID SEPARATOR ', ') Min_salary,
GROUP_CONCAT(DISTINCT dd.salary_description ORDER BY dd.salary_ID SEPARATOR ', ') Max_salary
FROM
post_jobs a
INNER JOIN user_salary cc ON FIND_IN_SET(cc.salary_ID, a.Min_salary)
INNER JOIN user_salary dd ON FIND_IN_SET(dd.salary_ID, a.Max_salary)
GROUP BY a.Job_id) aa
WHERE
MATCH (Keyword_Name) AGAINST ('"operation","mis","facility","sales"' IN BOOLEAN MODE)
OR MATCH (company_name, Designation) AGAINST ('"operation","mis","facility","sales"' IN BOOLEAN MODE)
AND max_exp <= 11
AND MATCH (location_name) AGAINST ('"delhi","mumbai","navi,mumbai"' IN BOOLEAN MODE)
AND Job_status = 'Active'
ORDER BY aa.Created_date DESC
LIMIT 0 , 25
显示相关表格的创建
e_pj_keywords CREATE TABLE `e_pj_keywords` (
`Keyword_ID` bigint(18) NOT NULL AUTO_INCREMENT,
`Job_ID` int(10) NOT NULL,
`Keyword_Name` varchar(100) NOT NULL,
PRIMARY KEY (`Keyword_ID`),
KEY `Job_ID` (`Job_ID`),
FULLTEXT KEY `Keyword_Name` (`Keyword_Name`)
) ENGINE=MyISAM AUTO_INCREMENT=1404 DEFAULT CHARSET=latin1
post_jobs CREATE TABLE `post_jobs` (
`Job_id` int(10) NOT NULL AUTO_INCREMENT,
`Designation` text,
`Company_Name` varchar(1000) NOT NULL,
`company_type` varchar(100) DEFAULT NULL,
PRIMARY KEY (`Job_id`),
FULLTEXT KEY `Company_Name` (`Company_Name`),
FULLTEXT KEY `Designation` (`Designation`)
) ENGINE=MyISAM AUTO_INCREMENT=176 DEFAULT CHARSET=latin1
locations CREATE TABLE `locations` (
`location_id` int(10) NOT NULL,
`location_name` varchar(100) NOT NULL,
`Nation` varchar(50) DEFAULT NULL,
PRIMARY KEY (`location_id`),
FULLTEXT KEY `location_name` (`location_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
答案 0 :(得分:0)
鉴于这些表格描述,这是您的问题:
OR MATCH (company_name, Designation) AGAINST
^^^^^^^^^^^^^^^^^^^^
您没有包含这两个字段的任何单个FULLTEXT
索引。 MySQL不会将两个单独的全文索引组合在一起用于查询 - 如果您正在进行多字段match
,那么必须有一个单一的全文索引,其中包含同一索引中的这两个字段。
您必须为每个索引拆分匹配项,或创建包含两个字段的新索引,例如
... MATCH 'foo' AGAINST (company_name) OR MATCH 'foo' AGAINST (desgination)
或
FULLTEXT KEY `foo` (company_name, designation)