Most of the website has their own search engine by using that any one can search documents on website. Open search is description is set of formats to describe website search engine. By using those document web search client application’s can search website.
OpenSearch description document is one the description document which is used to describe your search page and using this document in page head meta tad we can provide auto discovery of website search page.
OpenSearch description document is an xml document in which you need to provide all required information. Here is example of this document.
- Short name of website e.g. code4copy
- Description of website
- URL of favicon image of your website
- Web site search page URL with query string format e.g. ?q={searchTerms}
- Website rss search URL with query string e.g. q={searchTerms}
Here is my website Open search description document
<?xml version="1.0" encoding="utf-8"?> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <ShortName>code4copy</ShortName> <Description>Code snippets examples of java, c#, javascript and more</Description> <Image height="16" width="16" type="image/vnd.microsoft.icon">http://www.code4copy.com/pics/favicon.ico</Image> <Url type="text/html" template="http://www.code4copy.com/search?q={searchTerms}" /> <Url type="application/rss+xml" template="http://www.code4copy.com/syndication.axd?q={searchTerms}" /> </OpenSearchDescription>
Put this xml in your website(at root or any other accessible location) with name opensearch.xml or what any other you prefer.
By using this document search client application can you user website search page(engine).
We can add auto discovery of this document by adding meta tag in web pages head. This meta tag can be written to all pages or default page of website.
<link type="application/opensearchdescription+xml" rel="search" title="code4copy" href=http://www.code4copy.com/opensearch.xml />
Your website OpenSearch provider is read, you can verify this by using Google Chrome web browser. Just type you website domain and press space key, this we change Chrome address bar to search engine of your website as shown below.