2011-11-19 81 views
0

如果我使用Bings Webservice進行搜索並在未指定偏移量和計數的情況下進行搜索,則會收到98次搜索結果。如果我使用偏移量(如下面的代碼所示),總計數只有18個。Bings Search API並不總是返回相同的結果計數

如果我指定了偏移量,總計不應該是相同的嗎?

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>"; 
     } 

    } 
+0

我認爲伯爵應該是一樣的,是的。 – Amy

回答

0

有在the API Basics documentation警告的一些話:「根據查詢的熱門程度,結果的估計數量可能是從實數截然不同不要依賴於這個數字的關鍵計算」。我想知道計數和偏移量參數是否會使計算花費更長時間,因此在收集到許多結果之前它會停止運行?值得注意的是,the WebRequest.Count Property documentation提到「Count的最小值爲1;最大值爲50」,所以如果你確實爲Count指定了一個值,那麼你將會看到98以下的結果,而沒有指定Count 。

相關問題