【发布时间】:2017-10-27 22:36:34
【问题描述】:
我试图查询更智能的搜索结果,我在网上查看了 Leveshtein 和 similiar_text,但我相信 Leveshtein 算法是最好的选择,我如何在我的查询中实现 LEvenshtein 的算法?我在magento上找不到任何好的资源,甚至在attributeSelect上都找不到这个函数,这是我的初始代码。
function queryBuy($string){
$items = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('name')
->addFieldToFilter(array(
array('attribute'=>'name','like'=> "%".$string."%"),
));
我应该使用原始 SQL 吗? magento 有什么方法可以用吗?
【问题讨论】:
标签: php mysql magento magento-1.9