2017-08-10 156 views
0

的特定部分使用bing.com,我可以做這樣的搜索(點擊here的鏈接):如何限制Bing搜索API V5搜索網站

history site:berkeley.edu/about/ 

當我嘗試使用相同API,我得到了非常不同的結果。據我所知,搜索結果返回的網頁不在berkeley.edu中(請參見下方)。

這是HTTP GET請求被天青

https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0 

做這是我HTTP GET代碼

$.ajax({ 
     url: "https://api.cognitive.microsoft.com/bing/v5.0/search" 
     , data: { "q":encodeURI("history+site:berkeley.edu/about/"), "count":"10", "offset":"0" } 
     , beforeSend: function(xhrObj){ 
      xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","supply-your-key-here"); 
     } 
     , type: "GET", 
    }) 

任何想法我可能做錯了什麼?謝謝

編輯1:似乎我的「問題」與AJAX提出HTTP請求的方式有關。如果我使用Firefox頭部插件提供密鑰,並在我的瀏覽器URL框中鍵入(https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0),我會得到正確的響應。使用API​​

Environmental Design Library | UC Berkeley Library: A branch of the UC Berkeley Library system, the Environmental Design Library supports the research and teaching of the College of Environmental Design. 

Proceedings Template - WORD - ideals.illinois.edu: "(c) ACM, 2007. This is the authors’ version of the work. It is posted here by permission of ACM for your personal use. Not for redistribution. 

Trends in metadata practices: A longitudinal study of ...: Trends in metadata practices: A longitudinal study of collection federation. ... A Longitudinal Study of Collection Federation Carole Palmer Oksana ... 

http://aerospaceutility.tripod.com/ · GitHub: Clone via HTTPS Clone with Git or checkout with SVN using the repository's web address. 

HS RWC Colorado Sample Instructional Units - LiveBinder: Loading Livebinder HS RWC Colorado Sample Instructional Units HS Read Write Communicate Sample Instructional Units provided by the Colorado Department of Education. 

Arroyo High School: News Archive: News Archive SIA Awards "As the school year comes to a close, the Students in Action club would like to honor three students for their lasting impact on our ... 

English 12 (exp) | Utah Electronic High School: Please be mindful of the fact that this course is not a credit "quick fix." It is a rigorous, college-preparatory class that is both time and labor intensive. 

Working SMARTer, not Harder: SOCIAL STUDIES ONLINE ...: SOCIAL STUDIES ONLINE RESOURCES AND LINKS COMPILATION beta List of Social Studies online resources and links to professional development opportunities ... 

The Big List -- 20121008 - Grolier: The Big List -- 20121008: 1: EA: http://www.stanford.edu/group/bipolar.clinic/ Stanford Bipolar Disorders Clinic: 2: EA: http://www.mhsource.com/bipolar/ 

Spreadsheet of Conference Attendees - studylib.net: ÐÏ à¡± á > þÿ ] þÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ... 

回答

0

搜索結果我得到兩個V5.0和V7.0正確的結果。 你的查詢似乎沒有錯。

https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0 

也許你在你的瀏覽器的某處緩存結果?

更新:由於IE做到了,但Firefox沒有。你有沒有禁用緩存在IE瀏覽器?