Mar252009

Promoting your site through a search provider

Published by david at 5:47 PM under .NET Framework | ASP.NET

The importance of search today in e-commerce websites has become one of the backbone of this industry. For that is important that your site can provide an easy way to search through it. One of those ways is using OpenSearch.

OpenSearch provides a way to expose a search provider compatible with most recent browsers such as Internet Explorer 7, 8 and Firefox 3+.

So to do that here are the basic steps:

1. Create an open search XML file that respects the following:

Value Description
ShortName (required) This is the search provider's name that is displayed in the Instant Search box when your provider is selected.
URL (required) The URL for basic search queries to your search provider. It has to be an absolute URL.
Image (optional) Pointer to a favicon file of your search provider on your Web site. This icon is displayed next to the provider name in the Instant Search box. The icon must be a valid shortcut icon file otherwise a generic icon will be used.
Suggestions URL (JSON) (optional) This is the URL where JavaScript Object Notation (JSON) suggestions can be retrieved.
Suggestions URL (XML) (optional) This is the URL where XML-based suggestions can be retrieved.
PreviewUrl (optional) URL to display results in an Accelerator Preview Window.

 

The following sample OpenSearch Description file defines the type of search services you intent to offer:

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription 
       xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:ie="http://schemas.microsoft.com/Search/2008/">
    <ShortName>My Custom Search</ShortName>
    <Image height="16" width="16" type="image/icon">http://example.com/example.ico</Image>
    <Url type="text/html" 
                template="http://example.com/search.aspx?q={searchTerms}&amp;source=IE"/>   
    <Url type="application/x-suggestions+json" 
                template="http://suggestions.example.com/search.aspx?q={searchTerms}"/>
    <Url type="application/x-suggestions+xml" 
                template="http://suggestions.example.com/search.aspx?q={searchTerms}"/>
    <ie:PreviewUrl type="text/html" 
                template="http://suggestions.example.com/search.aspx?q={searchTerms}"/>
</OpenSearchDescription> 

2. Add the appropriate tags int you <head> element to your pages

<link title="My Provider" rel="search"
type="application/opensearchdescription+xml"
href="http://www.example.com/provider.xml">

 

That’s it. Users can now have access to your provider through the dropdown.



[KickIt] [Dzone] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tags: ,

E-mail | Permalink | Trackback | Post RSSRSS comment feed 0 Responses

Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
Loading