Google 或 Algolia 中类似亚马逊的自动完成关键字建议
Google or Amazon-like autocomplete keywords suggestion in Algolia
如何在 Algolia 中实现基于关键字的自动完成建议,类似于 Amazon 或 Google?
我尝试基于 Algolia 文档的多个属性构建自动完成功能,但它的目的并不能真正帮助我完成短语,而是指导我选择特定产品。
我没用过algolia但是google returns https://www.algolia.com/doc/search/auto-complete#introduction
I attempted building the autocomplete based on multiple attributes of an Algolia document, however its purpose does not really help me at completing a phrase but it directs me at selecting a specific product.
如果您想建议一些搜索而不是 products/objects,您可以使用搜索日志建立索引。如果您还没有它们,您可以使用 Algolia 的 Analytics API + top searches 端点来获取它们。
然后您可以将它们存储在 popular_searches
索引中,如下所示:
{
"value": "my popular search",
"count": 42 // the search frequency
}
并配置:
searchableAttribute
以 value
属性为目标
customRanking
使用desc(count)
作为反映人气的属性
话虽这么说,您应该知道,要达到 Amazon/Google:
的用户体验,设置此类热门搜索自动完成可能非常复杂
- 确保您使用的搜索足够受欢迎(去除低频率)
- 确保您使用的搜索实际上是在检索结果 -> 以确保您的用户在从下拉菜单中选择它时会得到结果(您可以在构建时查询您的产品索引)
- 确保你的搜索不包含垃圾邮件(非常容易做一个脚本轰炸你的 API 使垃圾邮件搜索非常受欢迎,所以它进入你的下拉菜单)
- 确保您的搜索不包含 offensive/bad 个词 :)(即使 google 也很难做到)
tldr; 如果您有选择,请从您的 products/objects 中预先计算搜索列表,而不是使用您的查询日志 :) 这样会更安全且更易于维护(我很确定亚马逊就是这样做的)。
如何在 Algolia 中实现基于关键字的自动完成建议,类似于 Amazon 或 Google?
我尝试基于 Algolia 文档的多个属性构建自动完成功能,但它的目的并不能真正帮助我完成短语,而是指导我选择特定产品。
我没用过algolia但是google returns https://www.algolia.com/doc/search/auto-complete#introduction
I attempted building the autocomplete based on multiple attributes of an Algolia document, however its purpose does not really help me at completing a phrase but it directs me at selecting a specific product.
如果您想建议一些搜索而不是 products/objects,您可以使用搜索日志建立索引。如果您还没有它们,您可以使用 Algolia 的 Analytics API + top searches 端点来获取它们。
然后您可以将它们存储在 popular_searches
索引中,如下所示:
{
"value": "my popular search",
"count": 42 // the search frequency
}
并配置:
searchableAttribute
以value
属性为目标customRanking
使用desc(count)
作为反映人气的属性
话虽这么说,您应该知道,要达到 Amazon/Google:
的用户体验,设置此类热门搜索自动完成可能非常复杂- 确保您使用的搜索足够受欢迎(去除低频率)
- 确保您使用的搜索实际上是在检索结果 -> 以确保您的用户在从下拉菜单中选择它时会得到结果(您可以在构建时查询您的产品索引)
- 确保你的搜索不包含垃圾邮件(非常容易做一个脚本轰炸你的 API 使垃圾邮件搜索非常受欢迎,所以它进入你的下拉菜单)
- 确保您的搜索不包含 offensive/bad 个词 :)(即使 google 也很难做到)
tldr; 如果您有选择,请从您的 products/objects 中预先计算搜索列表,而不是使用您的查询日志 :) 这样会更安全且更易于维护(我很确定亚马逊就是这样做的)。