快速搜索变高级搜索,快速搜索结果准确率提高

在MAGENTO的快速搜索中往往得不到好的结果,要嘛是查询不到产品,要嘛是所有产品都列出来,不像高级搜索结果那样理想。 有没有把快速搜索效率提高到高级搜索那个水平呢,可以按下面方法做:

  • Do a full DB backup (just in case) (以下操作万一出现问题了,能够还原,最好第一步就是备份数据库及要目录下的APP文件夹。) Replace “OR” with “AND” app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php at line 331 and 355. (修改此处文件的这二行, OR 改为 AND,注意大小写)
    • model rewrite through our custom module (more preferable)
    • placing the app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php into app/code/local/Mage/CatalogSearch/Model/Resource/Fulltext.php (faster approach, less preferable) (复制此处文件到这个文件夹)
  • Go into database then run: (进入MYSQL数据库,运行以下SQL语句)
    UPDATE catalog_eav_attribute SET is_searchable = 0;
     

    This will set all product attributes to “Use in Quick Search” => NO.

  • Go into database then run:(进入MYSQL数据库,运行以下SQL语句)
    UPDATE catalog_eav_attribute SET is_searchable = 1 WHERE attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = "name" AND entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = "catalog_product"));

    This will set only the “name” attribute to “Use in Quick Search” => YES, which is sort of the whole point of this article, having one or minimal set of searchable attributes to get more precise result set.

  • Go into database then run:(进入MYSQL数据库,运行以下SQL语句,此命令会删除以前建好的搜索条件/search terms,也可以不进行删除)
    DELETE FROM catalogsearch_query; DELETE FROM catalogsearch_fulltext;

    This will clear all previously built search query.

  • Go into Magento admin, then do a full reindex (actually only Catalog Search Index is relevant for this). (重建索行)

You can easily make an extension for switching Magento between its OR and your AND statement, have it exposed as configuration value under System > Configuration > Catalog > Catalog > Catalog Search > OR/AND.(此处可以修改搜索条件为OR还是AND,也就是LIKE/FULLTXT,试试会有不同结果)

Hope this helps.

转载于:https://www.cnblogs.com/qq9915072/p/4028523.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值