为什么“amazon-ecs”会这样?当搜索字符串太详细时,gem 没有返回结果?

发布于 2024-11-19 13:50:21 字数 1313 浏览 4 评论 0原文

我正在尝试从 Amazon Product Advertising API (amazon-ecs) gem 中提取搜索结果。我的搜索字符串存在问题,但仅限于搜索字符串过于详细的情况。

现在假设用户输入此搜索:

 search_string = 'big book of birth'

在这种情况下,这有效:

 res = Amazon::Ecs.item_search(search_string, {:response_group => 'Large', :search_index => 'Books'})

换句话说,在我的控制台中,我得到以下内容:

 res.has_error?
 => false

即使这有效:

 search_string = 'big book of birth by'
 res = Amazon::Ecs.item_search(search_string, {:response_group => 'Large', :search_index => 'Books'})

 res.has_error?
 => false

神秘的是,这不起作用:

 search_string = 'big book of birth by erika lyons'
 res = Amazon::Ecs.item_search(search_string, {:response_group => 'Large', :search_index => 'Books'})

 res.has_error?
 => true
 res.error
 => "We did not find any matches for your request." 

是否有一些我需要包含的选项/参数使此搜索像 Amazon.com 上的搜索一样“模糊”(例如,拼写检查、截断不必要的单词等)?在那里,搜索“big book ofbirth by erika lyons”会在 截断一些单词后位于列表顶部。

I'm trying to pull search results from the Amazon Product Advertising API (amazon-ecs) gem. I am having issues with my search string, but only when it is too detailed.

Now assume that a user enters this search:

 search_string = 'big book of birth'

In that case, this works:

 res = Amazon::Ecs.item_search(search_string, {:response_group => 'Large', :search_index => 'Books'})

In other words, in my console I get the following:

 res.has_error?
 => false

Even this works:

 search_string = 'big book of birth by'
 res = Amazon::Ecs.item_search(search_string, {:response_group => 'Large', :search_index => 'Books'})

 res.has_error?
 => false

Mysteriously, this DOES NOT WORK:

 search_string = 'big book of birth by erika lyons'
 res = Amazon::Ecs.item_search(search_string, {:response_group => 'Large', :search_index => 'Books'})

 res.has_error?
 => true
 res.error
 => "We did not find any matches for your request." 

Is there some options / param that I need to include to make this search "fuzzy" like the one on Amazon.com (e.g., spellchecker, truncating unnecessary words, etc.)? There, searching 'big book of birth by erika lyons' results in the exact book at the top of the list after truncating some words.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文