gpt4 book ai didi

php - 函数不搜索特定单词

转载 作者:行者123 更新时间:2023-11-29 09:19:56 24 4
gpt4 key购买 nike

这很奇怪,但我的搜索功能可以从我的项目表中搜索除“grinder”一词之外的任何单词。我已经尝试了所有方法,但似乎没有搜索该词。有人可以帮我吗?

CREATE FULLTEXT INDEX item_name_other_name_desc_index 
ON item (name,other_name,description)

public static function Search($string)
{

$delims = ',.; ';
$word = strtok($string,$delims);
while($word)
{

$result['accepted'][] = $word;
$word = strtok($delims);

}

$string = implode(" ", $result['accepted']);

$sql = 'SELECT item_id,name,other_name,description,price,discounted_price, thumbnail_photo,large_photo
FROM item
WHERE
MATCH(name,other_name,description)
AGAINST(:string)' ;
$parameters = array(':string' => $string);
$result['items'] = DB::GetAll($sql,$parameters);
return $result;
}

元素名称:9合15安培电机角磨机
8 台式研磨机
1/4 英寸角模磨床
7寸角磨机
3进直磨机
Ryobi HP512K 无绳电钻/起子套件
6 件装喷漆
非接触式电压测试仪

当我将上面的内容更改为:
9合15安培电机角磨机
8 在台式研磨
1/4 英寸角模具研磨
7 角磨削
3 直磨
Ryobi HP512K 无绳电钻/起子套件
6 件装喷漆
非接触式电压测试仪

我搜索 Grinder,记录 => 正在显示 9 In 15 AMP Motor Angle Grinder。

最佳答案

默认情况下,mysql 全文搜索将出现次数超过 50% 或行数的单词视为停用词 ( http://dev.mysql.com/doc/refman/5.1/en/fulltext-natural-language.html )。尝试在 bool 模式 ( http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html ) 下搜索,其中没有 50% 阈值。

关于php - 函数不搜索特定单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2369724/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com