英文:
Restricting Shopify search to only use tags and titles, excluding descriptions
问题
我想在我的Shopify网站上自定义搜索功能。目前,当用户搜索关键词“legging”时,搜索结果包括具有匹配标签、标题和描述的产品。然而,我希望修改搜索功能,只基于标签和标题生成结果,完全排除产品描述。
有人可以指导我如何在Shopify的搜索栏中实现这种自定义吗?非常感谢您的帮助。
网站链接是https://winnerforce-lb.com/
我尝试在我们的prestige主题中修改代码,但是我自己无法实现。
英文:
I want to customize the search functionality on my Shopify website. Currently, when users search for a keyword like "legging," the search results include products with matching tags, titles, and descriptions. However, I want to modify the search to only generate results based on tags and titles. The search should exclude the product descriptions altogether.
Can anyone guide me on how to achieve this customization for the search bar in Shopify? Your help would be highly appreciated
Website link is https://winnerforce-lb.com/
I tried modifying the code within our prestige theme, but i couldnt make it by myself.
答案1
得分: 1
如果你需要实际的帮助,你应该在Shopify论坛上发布。通过查看你的链接,我可以说在主题的sections文件夹中应该有一个名为"predictive-search.liquid"的section liquid文件。你需要使用一些liquid字符串匹配函数来从search.results
对象中过滤出符合item.title
或item.tags
中包含search.terms
的项目。如果你对Shopify的liquid api还不熟悉,这是一个关于search对象的链接。
英文:
You should post it on Shopify forums if you need hands-on help. By looking at your link, I can say there is should be a section liquid file named "predictive-search.liquid" in sections folder of the theme. You need to use some liquid string matching functions to filter items from search.results
object to make sure search.terms
is present in item.title
or item.tags
. If you are new to Shopify liquid api, here is a link to search object.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论