Adding OpenSearch for your CommunityServer Site

So last night, I had this really random idea to create an OpenSearch Provider for LonghornBlogs.com. That way I could search my site from IE7's search box. In the process, I discovered that my search is broken there, so I decided to create them for several of the main Microsoft community sites instead:

Maybe Telligent will create an OpenSearch directory for all the CS communities out there. We'll have to wait and see. Anyways, if you want to write your own, I'll show you how!

Writing Your Own Provider:

Here's what a CS 2.0 OpenSearch provider looks like:

<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
 <ShortName>Your Name Here</ShortName>
 <Description>Your Description Here</Description>
 <Url type="text/html" template="http://www.yoursitehere.com/search/SearchResults.aspx?q={searchTerms}&amp;o=Relevance" />
</OpenSearchDescription>

When you form your URLs, make sure they are UrlEncoded first, or they'll throw an error.

Installing Your OpenSearch Provider:

You'll have to add a hyperlink to the provider on your website. Just use the following syntax for your link: <a href="#" onClick="window.external.AddSearchProvider(&quot;http://www.yoursitehere.com/yoursearchprovider.xml&quot;);">

That's it! It's really very simple. Of course, you can add a lot more information to your OpenSearch provider. Amazon's A9 has all the details.

No Comments