The products listed above, and their associated names, icons and logos, are the intellectual property of Microsoft Corporation.
Adding Live Search Functionality To Your Website

Author: Daniel Wissa

Adding Live Search Functionality To Your Website
This article explains the different ways you can use to integrate Windows Live Search functionality to your website. There are 3 different ways by which this can be done: Using the Basic Live Search Box, using the Advanced Live Search Box and using the MSN Search Web service.

The first option allows you to add a search box to your site but displays the results on the Live Search website, the second adds a search box to your site but displays the results in a window that pops up below the search box showing all results in it and the third option allows you to add the search box to your site and displays the results in a page that is part of your website. These three options are explained in more details in the next three sections

1)      Adding the Basic Search Box to your site

To do the above head to the following link http://search.live.com/siteowner?mkt=en-us, then click the Get Started button under the Basic Search Box section on the left  shown below

After clicking the Get Started button you will be taken to a page that displays the code you will need to add the search box to your site, at the top of the page you will see a reference to the following piece of code

You need to replace this text with the value relevant to the language you are using for Latin languages this is 1252 as mentioned in the article.

If you want the search box to only search your site and not the entire web, all you need to do is add the following code under the code for the submit button on the page and replace the text with your site’s name. Easy!

2)      Adding the Advanced Search Box to your site

If you wish to use the advanced search box option instead click the Get Started button of the Advanced Search Box option shown on the right above. This can be done in three steps explained below
Step  1: Pick a Search Type

From the options shown below, choose a search type; you can add a site search and specify one or more sites to be searched, or you can use an existing search macro from here http://gallery.live.com/default.aspx?pl=4&bt=13 or create your own. A simple way to understand what a search macro is basically defining a set of site/search criteria and setting these up as a search template that you use search on, which basically means that your search will be limited to only the sites/criteria defined by your macro.

Step  2: Customize It & Paste the generated HTML into your site

Once you’ve chosen your search type you can then customize it’s look & feel using the options shown below and once happy with it, click next and copy the generated HTML into your site and that’s all you need to do.

3)      Adding Search To Your Site Using the MSN Search Web Service

This is the third way you can use to include Live Search Functionality to your site. If you wish to read a full tutorial on how this can be done you can see that here http://msdn2.microsoft.com/en-us/library/bb229148.aspx. But if you want to take a shortcut here’s all you need to do to get Live Search integrated into your website
2 – Obtain a Search API ID from here http://dev.live.com/blogs/livesearch/archive/2006/06/07/27.aspx and follow the instructions on how to place that in your code
3 - The only thing left to do from here is that you specify which site/sites you want the search to operate on this is done by replacing the following code that exists in the Default.htm file in the source downloaded from the link mentioned earlier, with the values that you want.
var sc = new searchClient('keyAndCount', 'returnArea', "(site:www.viawindowslive.com)");
In the example above I’ve specified ViaWindowsLive to be the only site to search on. If search is running properly your results should appear in the div section that has the id returnArea on the Default.htm page
4 – Use the Live Search SDK http://dev.live.com/livesearch/sdk/  to see different ways that you can use to customize your code
 
 
 
Copyright 2009. Sponsored by nsquared.   |  Terms Of Use  |  Privacy Statement
Content on this site is generated from the developer community and shared freely for your enjoyment and benefit. This site is run independently of Microsoft and does not express Microsoft's views in any way.