magento 1.6 中的多词搜索
我最近将我的 magento 从 1.4 升级到 1.6.1,修复了很多错误后,我仍然有一个问题。当我搜索多个单词时,目录搜索将返回许多结果。 例如“samsung 2100”它将搜索Samsung OR 2100上的所有内容。
我尝试编辑
-app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php(甚至在损坏后什么也没做)
-app/code/local /Mage/CatalogSearch/Model/Mysql4/Fulltext.php(即使在损坏后也什么也没做)
-app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(做了一些事情)
http://www.magentocommerce.com/boards/viewthread/233799/#t360244
I recently upgraded my magento from 1.4 to 1.6.1 after fixing lots of bugs i still have one issue. When i search on multiple words, the catalog search will return to many results.
eg "samsung 2100" it will search everything on Samsung OR 2100.
I have tried editing
-app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php(did nothing not even after corrupting)
-app/code/local/Mage/CatalogSearch/Model/Mysql4/Fulltext.php(did nothing not even after corrupting)
-app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(did something)
http://www.magentocommerce.com/boards/viewthread/233799/#t360244
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
转到此文件:
/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php
第 345 行更改或 —>并
删除现有的搜索词。刷新缓存....应该像魅力一样工作,
请在此处查看... Dholo.com
尝试使用 Multiword搜索...它仅返回同时具有术语/的产品
Go to this file :
/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php
in Line 345 Change OR —> AND
Delete the existing search terms. refresh cache....should work like a charm
check it out here.... Dholo.com
try using Multiword search...it returns only the products which have both the terms/
我在 Magento 的默认搜索中发现的一件事是,它在“加权重要字段”方面可能会更智能一些
对于我们来说,我们发现很多搜索查询都包含品牌名称。例如“耐克跑鞋”。
我们还发现很多搜索短语在某种程度上与我们设置的类别相关。例如“跑鞋”
我所做的是编写了一段代码,将从搜索查询中提取品牌名称和类别,并将它们用作 Fulltext.php 保存到结果表中的产品 ID 的过滤器。
移动上述 php 文件
您想要从/app/oode/core/Mage/CatalogSearch/Model/Resource/Fulltext.php
到
/app/code/local/Mage/CatalogSearch/Model/Resource/Fulltext.php
我所做的是将我的代码调整放在:
https://gist.github.com/jaseclamp/10083937
在我们的情况下,仅仅这一点代码就大大提高了我们搜索结果的准确性。上面的代码似乎也没有与 Magento 在同义词和重定向等方面所做的任何事情发生冲突。此外,下面的页面会显示“‘原始搜索短语’的搜索结果”,即使我们在搜索过程中修改了搜索短语。实际的 MySQL 查询使其更加有效。它使搜索处理时间增加了几微秒,但是一旦结果被缓存,后续搜索就会很快。
如果你想看看我的代码如何调整MySQL用于将搜索结果插入到结果表中,只需
在函数末尾的“$adapter->query”之前输入:
One thing I found with Magento's default search is that it could be a bit smarter in "weighting important fields"
For us we found that a lot of our search queries included brand names. E.g. 'nike running shoes'.
We also found that a lot of search phrases somehow correlated to categories we'd setup. E.g. 'running shoes'
What I did was wrote a chunk of code that will extract brand names and categories from the search query and use those as filters on the product id's that Fulltext.php saves into the results table.
You want to move the above noted php file from
/app/oode/core/Mage/CatalogSearch/Model/Resource/Fulltext.php
to
/app/code/local/Mage/CatalogSearch/Model/Resource/Fulltext.php
What I've done is put my code adjustment at:
https://gist.github.com/jaseclamp/10083937
In our situation just this little bit of code greatly increased the accuracy of our search results. The code above also did not seem to conflict with anything Magento was doing in terms of synonmys and redirects, etc. Also the following page would say "Search results for 'original search phrase'" even though we'd modified the search phrase during the actual MySQL query to make it more effective. It added a few microseconds to the processing of the search however once the result was cached subsequent searches would be fast.
If you want to see how my code adjusts the MySQL used to insert the search results into the results table just put:
Before the "$adapter->query" at the end of the function.