我正在使用以下查询来搜索文本
$query = "SELECT SQL_CALC_FOUND_ROWS *," .
"MATCH (keywords) AGAINST ('". $searchString ."'IN BOOLEAN MODE ) AS rel1, ".
"MATCH (title) AGAINST ('". $searchString ." 'IN BOOLEAN MODE ) AS rel2, ".
"MATCH (description) AGAINST ('". $searchString ." 'IN BOOLEAN MODE) AS rel3 ".
"WHERE MATCH (keywords,title,description) AGAINST ('" .$searchString. "' IN BOOLEAN MODE) " .
"FROM cron_video " .
"ORDER BY (rel1*1.5)+(rel2*1.25)+(rel3*1) desc, `cron_status` ASC LIMIT $start, $pagesize";
但是,下面的搜索id
的查询是错误的,它是BigInt类型。
$query = "SELECT SQL_CALC_FOUND_ROWS *," .
"MATCH (id) AGAINST ('*". $searchString ."*' IN BOOLEAN MODE ) AS rel1," .
"FROM cron_video " .
"WHERE MATCH (id) AGAINST ('*" .$searchString. "*' IN BOOLEAN MODE) AS rel2" .
"ORDER BY (rel1*1.5)+(rel2) desc, `cron_status` ASC LIMIT $start, $pagesize";
我的怀疑:
1.对于BigInt类型,是否可以进行全文搜索。
关于第一个查询:
答案 0 :(得分:2)
Full-text indexes can be used only with MyISAM tables, and can be created only for CHAR, VARCHAR, or TEXT columns.
请记住,SELECT * FROM ...
不是表现友好的选择字段的方法。而是只选择您需要的字段。例如:SELECT f1, f2, f3 FROM t1
。它会好得多。
修改强>
抱歉,我的错,在布尔模式下得分为0或1.所以你的代码是正确的。