2017-08-10 17 views
0

En utilisant bing.com, je peux faire une recherche comme celui-ci (cliquez here pour le lien):Comment limiter l'API Bing Search V5 pour rechercher des sections spécifiques du site

history site:berkeley.edu/about/ 

Lorsque je tente la même chose en utilisant la API, j'obtiens des résultats très différents. Pour autant que je sache, les résultats de la recherche renvoie des pages Web qui ne sont pas hébergées dans berkeley.edu (voir en bas).

c'est la requête HTTP GET étant fait pour Azure

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

Ceci est mon code 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", 
    }) 

Toutes les idées que je pourrais faire mal? Merci

edit1: Semble mon "problème" est lié à la façon dont AJAX effectue la requête HTTP. Si je fournis ma clé en utilisant un plugin d'en-tête Firefox et que je tape (https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0) dans la case URL de mon navigateur, j'obtiens la bonne réponse.

résultats de recherche en utilisant l'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: ÐÏ à¡± á > þÿ ] þÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ... 

Répondre

0

Je reçois des résultats corrects sur les deux v5.0 et v7.0. Il semble que rien ne cloche avec votre requête.

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

Vous avez peut-être mis en cache des résultats quelque part dans votre navigateur?

Mise à jour: Comme IE le fait, mais pas Firefox. Avez-vous désactivé le cache sur IE?

1

Vous pouvez utiliser la recherche Bing personnalisée en alternance pour vous assurer d'obtenir les résultats à partir du domaine/pages Web que vous voulez. Voici l'appel: https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search. Vous aurez besoin d'une clé d'accès différente, que vous pouvez obtenir auprès de customsearch.ai.