为什么“amazon-ecs”会这样?当搜索字符串太详细时,gem 没有返回结果?
我正在尝试从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论