我在innoDB数据库中使用fullText搜索时遇到了很大问题 首先,ns_pages表有超过2.6米的记录,全文索引有3个密钥块 该数据库运行在配备128GB Ram的Dell R710上 当我使用此查询时,数据库停止工作 如果我使用webmin检查查询,我会看到查询仍然有效,直到超时。
SELECT sh.id,body, `source`, `page_in_source`, `datepaper`, `folder`
, `attach_fn`, Description,s.ImgFName
FROM ns_pages sh INNER JOIN ns_source s on s.id=sh.source where viewnews=1
AND DATE_ADD(sh.datepaper,INTERVAL s.days_in_advance DAY)
BETWEEN '2017-12-22' AND '2017-12-22'
AND source in (1815,345,1,382,89,14,12,239,108,119,485,490,13,509,2,537,182,193,333,559,1817,111,506,1615,1752,248,33,34,35,357,36,458,131,26,27,32,30,29,31,28,1816)
AND MATCH (body) AGAINST ('"United States of America"' IN BOOLEAN MODE)
order by datepaper, DistributionArea, cadence, Description, page_in_source desc
但是简单的一个很好用
SELECT sh.id,body, `source`, `page_in_source`, `datepaper`, `folder`
, `attach_fn`, Description,s.ImgFName
FROM ns_pages sh INNER JOIN ns_source s on s.id=sh.source where viewnews=1
AND DATE_ADD(sh.datepaper,INTERVAL s.days_in_advance DAY)
BETWEEN '2017-12-22' AND '2017-12-22'
AND source in (1815,345,1,382,89,14,12,239,108,119,485,490,13,509,2,537,182,193,333,559,1817,111,506,1615,1752,248,33,34,35,357,36,458,131,26,27,32,30,29,31,28,1816)
AND MATCH (body) AGAINST ('Jamaica' IN BOOLEAN MODE)
order by datepaper, DistributionArea, cadence, Description, page_in_source desc
答案 0 :(得分:0)
问题在于文本
MATCH (body) AGAINST ('"United States of America"' IN BOOLEAN MODE)
搜索字词包括美利坚合众国在双引号内,在我针对FullText搜索的MySQL布尔搜索中,内容被视为单个搜索。
删除双引号
MATCH (body) AGAINST ('United States of America' IN BOOLEAN MODE)