Recently, I was building an open search provider for a client's web site. By building a search provider for your website, you give the ability to the users to use Internet Explorer's search box to quickly search your web site for the desired content. A search provider is also installed as an accelerator, thus providing even more search power and ease of use to the end user.
MSDN has a very comprehensive article on building search providers for Internet Explorer 8. I wanted to include support for visual search suggestions, which is a fairly easy proccess, one has to create a page or handler that returns an XML (or JSON) response, based on the search term provided. This XML would look like this:
<?xml version="1.0"?>
<SearchSuggestion xmlns="http://schemas.microsoft.com/Search/2008/suggestions">
<Query>xbox</Query>
<Section>
<Item>
<Text>Xbox 360</Text>
<Description>The official Xbox website from Microsoft</Description>
<Url>http://www.xbox.com</Url>
</Item>
<Item>
<Text>Xbox cheats</Text>
<Description>Codes and walkthroughs</Description>
<Url>http://www.example.com/xboxcheatcodes.aspx</Url>
</Item>
<Item>
<Text>Xbox 360 games</Text>
<Description>Games and accessories</Description>
<Url>http://www.example.com/games</Url>
</Item>
</Section>
</SearchSuggestion>
So, I went on and created a handler that returns the search results as an XML document like the sample above. Unfortunately, I couldn't make it work in Internet Explorer; no matter what I typed in the search box, I always got a "An error occured" error message, and no results were shown.
After spending a lot of time in debugging the handler, I finally figured out what was going wrong; I was omitting the namespace declaration in the <SearchSuggestion> element. I found many blog posts that were also omitting the namespace declaration on their samples, so I didn't think this would be the problem. So, if you are also getting the same error, check the namespace declaration, maybe this will do the trick for you as well.
Also, you will want to make sure that the <Query> element has as text the actual query phrase as entered by the user, because if not Internet Explorer will again show that error message.