none
Bing Search API: Does the market parameter work as expected?

    Question

  • Hello! 

    We are trying to retrieve market-/region-specific search results via the Bing Search API (e.g. Singapore). 

    Unfortunately, the search results do not vary for any of the en-* market parameter values. 

    This behaviour has been reproduced with the API's web interface as well. 

    Interestingly, the web search as accessible at bing.com works perfectly well - the region can be specified via "Only from Singapore" vs. "All regions". 

    Is there any possibility to narrow down search results as retrieved by API in the same manner as in the web interface at bing.com?

    Many thanks and best regards,

    Lutz

    Friday, August 09, 2013 3:09 PM

Answers

  • HI

    I’m not very clear about you question.

    But I can't repro you error on my side.

    I use EN-CA

    And here is my results:

    I also use the code, and I can get the same results as the picture shows.

     string market = "en-ca";
     protected void btnWebSearch_Click(object sender, EventArgs e)
            {
                Repeater rptResult=new Repeater();
               
                // This is the query expression.
                string query = tbQueryString.Text;
                var bingContainer = new Bing.BingSearchContainer(new Uri(rootUrl));
    
                // Configure bingContainer to use your credentials.
                bingContainer.Credentials = new NetworkCredential(AccountKey, AccountKey);
    
                // Build the query, limiting to 10 results.
                var webQuery =bingContainer.Web(query, null, null, market, null, null, null, null);
                webQuery = webQuery.AddQueryOption("$top", 50);
          
               
                // Run the query and display the results.
                var webResults = webQuery.Execute();
                Label lblResults = new Label();
                StringBuilder searchResult = new StringBuilder();
    
                foreach (Bing.WebResult wResult in webResults)
    	        {
                    searchResult.Append(string.Format("<a href={2}>{0}</a><br /> {1}<br /> {2}<br /><br />",
                        wResult.Title,
                        wResult.Url,
                        wResult.Description));
    
    	        }
                lblResults.Text = searchResult.ToString();
                Panel1.Controls.Add(lblResults);
               
            }

    please try the codes in bing API quick start:

    https://skydrive.live.com/view.aspx?resid=9C9479871FBFA822!112&app=Word&authkey=!ANNnJQREB0kDC04

    You may get the right behavior.

     

    Please mark post as answered if it helped!

    Saturday, August 10, 2013 5:18 AM

All replies

  • HI

    I’m not very clear about you question.

    But I can't repro you error on my side.

    I use EN-CA

    And here is my results:

    I also use the code, and I can get the same results as the picture shows.

     string market = "en-ca";
     protected void btnWebSearch_Click(object sender, EventArgs e)
            {
                Repeater rptResult=new Repeater();
               
                // This is the query expression.
                string query = tbQueryString.Text;
                var bingContainer = new Bing.BingSearchContainer(new Uri(rootUrl));
    
                // Configure bingContainer to use your credentials.
                bingContainer.Credentials = new NetworkCredential(AccountKey, AccountKey);
    
                // Build the query, limiting to 10 results.
                var webQuery =bingContainer.Web(query, null, null, market, null, null, null, null);
                webQuery = webQuery.AddQueryOption("$top", 50);
          
               
                // Run the query and display the results.
                var webResults = webQuery.Execute();
                Label lblResults = new Label();
                StringBuilder searchResult = new StringBuilder();
    
                foreach (Bing.WebResult wResult in webResults)
    	        {
                    searchResult.Append(string.Format("<a href={2}>{0}</a><br /> {1}<br /> {2}<br /><br />",
                        wResult.Title,
                        wResult.Url,
                        wResult.Description));
    
    	        }
                lblResults.Text = searchResult.ToString();
                Panel1.Controls.Add(lblResults);
               
            }

    please try the codes in bing API quick start:

    https://skydrive.live.com/view.aspx?resid=9C9479871FBFA822!112&app=Word&authkey=!ANNnJQREB0kDC04

    You may get the right behavior.

     

    Please mark post as answered if it helped!

    Saturday, August 10, 2013 5:18 AM
  • Hello Yuan2013,

    thank you very much for your reply. 

    We managed to solve our problem by adding a "loc:XX" (e.g. "loc:SG") term to the query itself. Only then the results seem localized in any way, otherwise (i.e. by applying the market parameter) no change in the search results could be recognized. 

    The "loc:XX" term corresponds to the "narrow by region" option in the Bing web search. 

    Best wishes,

    Lutz

    Tuesday, August 20, 2013 12:52 PM