如果我使用Bings Webservice进行搜索,并且搜索时没有指定偏移量和计数,我会收到98个搜索结果。如果我使用offset (如下面的代码所示),那么总计数只有18。
如果我指定offset或不指定offset,那么总计数不应该相同吗?
BingService soapClient = new BingService();
SearchRequest request = new SearchRequest();
request.AppId = ConfigurationManager.AppSettings["BingKey"];
request.Sources = new BingLiveSearchService.SourceType[] { SourceType.Web };
request.Query = query;
request.Web = new BingLiveSearchService.WebRequest { Count = 20, Offset = 21, OffsetSpecified = true, CountSpecified = true };
string resp = string.Empty;
var response = soapClient.Search(request);
if (response.Web != null && response.Web.Total > 0)
{
resp += "TOTAL COUNT:" + response.Web.Total + "<br/><br />";
foreach (var item in response.Web.Results)
{
resp += "<div style='padding-bottom:10px;'> + item.Title + "</div>";
}
}
发布于 2012-07-02 20:08:12
在the API Basics documentation中有一些警告:“根据查询的受欢迎程度,估计的结果数量可能与实际数字大不相同。不要依赖这个数字进行关键计算”。我想知道count和offset参数是否会使计算花费更长的时间,因此在收集到如此多的结果之前会暂停计算?同样值得注意的是,the WebRequest.Count Property documentation提到“Count的最小值是1;最大值是50",所以如果您为Count指定了一个值,那么您得到的结果将少于您在没有指定Count的情况下看到的98个结果。
https://stackoverflow.com/questions/8196025
复制相似问题