PHP MySQL Match() Against() 全文搜索对某些关键字不起作用

问题描述:

我是 php 开发人员,我在使用 MySQL 全文搜索时遇到问题.

I am working as php developer, and I have an issue with MySQL fulltext searches.

这是我的查询

select distinct j.jobid,headline,company,country,state,city,location,
date_format(str_to_date(posted_dt, '%m-%d-%Y %H:%i:%s' ), '%M %d, %Y') posted_dt,joblinks 
from jobs j 
left join job_filters jf on jf.jobid = j.jobid 
left join job_emptype_map em on j.jobid = em.jobid 
left join job_sub_emptype_map sem on em.jobid = sem.jobid and em.emp_type = sem.emp_type 
where status=1 
And MATCH (headline,description,pri_skills,company) AGAINST ('java developer' IN natural language MODE) > 1 
And MATCH (location,country,state,city,zipcode,other_loc) AGAINST ('california, United States' WITH QUERY EXPANSION ) > 1 
order by str_to_date(posted_dt,'%m-%d-%Y %H:%i:%s') DESC limit 0,25

我通过上述查询得到了正确的结果.但它需要(显示第 0 - 24 行(共 25 行,查询耗时 50.6951 秒.)

I am getting proper results with above query. But it is taking (Showing rows 0 - 24 (25 total, Query took 50.6951 seconds.)

当我更改关键字ui developer"而不是java developer"时,我得到 0 个结果

when I change the keyword "ui developer" instead of "java developer" then I am getting 0 results

如果我用类似的函数检查关键字ui developer",那么我就会得到结果.

if i check keyword "ui developer" with like function then i am getting results.

我不明白为什么匹配功能仅适用于某些关键字,以及为什么在我的托管计划是云时花费太多时间.

I am not understanding why match function is working for some keywords only and why it is taking too much of time when my hosting plan is cloud.

我现在在做云服务器计划,我已经用类似的功能更新了我的查询,现在我的查询是...

I am on cloud server plan now and I have updated my query with like function, now my query is...

select distinct j.jobid,headline,company,country,state,city,location,date_format(str_to_date(posted_dt, '%m-%d-%Y %H:%i:%s' ), '%M %d, %Y') posted_dt,joblinks, (select count(distinct j.jobid) as jobcount from jobs j left join job_filters jf on jf.jobid = j.jobid left join job_emptype_map em on j.jobid = em.jobid left join job_sub_emptype_map sem on em.jobid = sem.jobid and em.emp_type = sem.emp_type where status = 1 and (concat(headline,' ',description,' ',pri_skills,' ',company) like '%java programer%' ) And ( country like '%United States%' ) ) jobcount from jobs j left join job_filters jf on jf.jobid = j.jobid left join job_emptype_map em on j.jobid = em.jobid left join job_sub_emptype_map sem on em.jobid = sem.jobid and em.emp_type = sem.emp_type where status=1 and (concat(headline,' ',description,' ',pri_skills,' ',company) like '%java programer%' )And ( country like '%United States%' ) order by str_to_date(posted_dt,'%m-%d-%Y %H:%i:%s') DESC limit 0,25   

我已经在上面的分页查询之间编写了选择查询,上面的查询得到了很好的结果但是花费了太多时间,请注意:我的工作表有大约 50,000 多条记录

i have writen select query between above query for pagination, above query is getting good results but taking too much of time, Pleas Note: my jobs table has around 50,000+ records