如果我输入8in Wrench
这样的描述,我希望得到像WRENCH ADJUSTABLE CRESCENT 8IN
这样的结果,但我找不到结果。如果我搜索Adjustable Wrench
或Crescent Wrench
它可以正常工作,但不适用于8in wrench
。
为什么不返回所需的结果?
这是mysql查询
$term = request()->term;
$exp = explode(' ', $term);
$s = '';
$c = 1;
foreach ($exp AS $e)
{
$s .= "+$e*";
if ($c + 1 == count($exp))
$s .= ' ';
$c++;
}
SELECT
`items`.`*`,
`itemunits`.`*`,
`vendoritems`.`*`,
FROM
`items`
INNER JOIN
`itemunits`
ON `itemunits`.`itemcode` = `items`.`itemcode`
INNER JOIN
`vendoritems`
ON `vendoritems`.`itemcode` = `items`.`itemcode`
WHERE
(
`items`.`deleted` = 0
AND `vendoritems`.`deleted` = 0
)
AND
(
MATCH (items.description) AGAINST ( $s IN BOOLEAN MODE)
OR MATCH (vendoritems.partnumber) AGAINST ('$s' IN BOOLEAN MODE)
)
GROUP BY
`items`.`itemcode`,
`vendoritems`.`itemcode`,
`itemunits`.`itemcode`
ORDER BY
items.description"