当我搜索包含超过10000个匹配项的查询时,会出现以下错误:
{u'message': u'Request depth (10100) exceeded, limit=10000', u'__type': u'#SearchException', u'error': {u'rid': u'zpXDxukp4bEFCiGqeQ==', u'message': u'[*Deprecated*: Use the outer message field] Request depth (10100) exceeded, limit=10000'}}
当我搜索范围更窄的关键字和结果更少的查询时,一切正常,不会返回错误。在
我想我得设法限制搜索,但我不知道怎么做。我的搜索功能如下:
^{pr2}$它的名字是这样的:
results = searcher.execute_query_string(request.GET.get('q', ''))[:100]
如您所见,我试图用start
和size
属性来限制结果。但我还是得到了错误。在
我一定是误解了如何避免在一个搜索结果中得到超过10000个匹配项。有人能告诉我怎么做吗?在
关于这个主题,我能找到的只有Amazon's Limits,它说你只能请求10000个结果。它没有说明如何限制它。在
您正在调用
get_all_hits
,它将获取查询的所有结果。这就是您的size
参数被忽略的原因。在从文件中:
http://boto.readthedocs.org/en/latest/ref/cloudsearch2.html#boto.cloudsearch2.search.SearchConnection.get_all_hits
您应该调用
search
,而不是http://boto.readthedocs.org/en/latest/ref/cloudsearch2.html#boto.cloudsearch2.search.SearchConnection.search相关问题 更多 >
编程相关推荐