Live Search API troubleshooting tips

24 March 2009
I tried to add the Microsoft Live Search API 2.0 to my site and ran into a couple of problems.
I used the JSON sample at \Live Search API 2.0 SDK\Samples\JSON\WebSample.html
the sample worked fine as is, but when I added a like this on line 21
it stopped returning any results, even though the same query on works.
After playing around for a while, I figured out I had to remove
 + "&Web.FileType=DOC"

and while I was at it, I also removed:
 + "&Market=en-us"
now the searches worked.

The second problem was when they were really no search results, I got a JavaScript error:
results is undefined
(response.SearchResponse.Web.Offset + results.length)
on line: 84
To fix this, I added some code around the results display:
   if (response.SearchResponse.Web.Results == null)
        resultsHeader.innerHTML = "No results found";
        // display results

Pages in this section


ASP.Net | Community | Development | IIS | IT Pro | Security | SQL (Server) | Tools | Web | Work on the road | Windows