Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you form a compound query using Bing Marketplace API?
    text
    copied!<p>I have an application that is using the new Bing API from the Azure Datamarketplace. I used to be able to query the Bing API using a simple syntax using OR AND, etc. That doesn't seem to work in the new API.</p> <p>Old syntax:</p> <p>"Jacksonville Jaguars" OR "NFL Jaguars" OR "Atlanta Falcons"</p> <p>That would give me a query with any of those phrases (I am making a rt_Sports query for news).</p> <p>I am calling HttpEncode on the query first, but am still not getting results. It works if I remove all the " marks, but then I am getting results sometimes for news about Falcons and Jaguars (the animals)... Not what I wanted.</p> <p>Anyone have any idea how you can form a query that takes multiple phrases?</p> <p>I have tried to not use the OR, not use the ', use a ", use the | instead of OR. All of these work against BING the website, just not in the API.</p> <p>I just tried this via Bing and got 36 Million results:</p> <p>NFL Football | Seattle Seahawks | New York Giants | Dallas Cowboys | New Orleans Saints | New England Patriots | Jacksonville Jaguars</p> <p>Same thing in the API returns 0.</p> <p>I got an email from a friend who I also emailed this question out to and his thought was that I was going about it wrong. That there should be a way to form a LINQ query off the Bing object with multiple where clauses.</p> <p>But I don't see how that would be possible. You allow a BingSearchContainer and then call the News method on the container. The News method has only a single Query parameter.</p> <pre><code>var bingContainer = new Bing.BingSearchContainer(new Uri("https://api.datamarket.azure.com/Bing/Search")); bingContainer.Credentials = new NetworkCredential(App.BingAPIAccountKey, App.BingAPIAccountKey); string unifiedQuery = "NFL Football | Jacksonville Jaguars | Atlanta Falcons"; var newsQuery = bingContainer.News(unifiedQuery, null, "en-US", "Strict", null, null, null, "rt_Sports", "Relevance"); newsQuery.BeginExecute(BingNewsResultLoadedCallback, newsQuery); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload