2

我正在尝试从亚马逊产品广告 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' 会在截断一些单词后在列表顶部找到确切的书。

4

0 回答 0