Download - Search Capabilities for Dynamic Web Content
Search Capabilities for ASP.NET Web Content
Jonathan HawkinsArchitectASP.NETMicrosoft Corporation
Nathan BuggiaSenior Product PlannerLive SearchMicrosoft Corporation
Agenda
Why is Search important?How to make a Search friendly site Search enable your ASP.NET site Search Sitemaps and dynamic dataImproving your Search experience with Live
Search Engines Drive a lot of Traffic
Direct, 30%Google, 30%
Yahoo, 12%
MSN\Live, 3%
Other, 25%
Site Referrals Q1-Q4 2006
"Search" is the new "Browse"
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
47% Search
33% Browse
13% Abandon
When you’re looking for specific information on an unfamiliar website…
Forrester Research, forrester.com. “It’s time to update site search functionality”, 5/1/2006, Iris Cremers
How to Make a Search Friendly Site Crawlers index HTML text and follow links
Crawlers visit your site on a regular basis and index for new contentDetermine relevancy relative to the rest of the web
Make pages for usersProduce well formed HTML for your websiteUse text words for key terms as crawlers can't index imagesEnsure Title and ALT tags are descriptive
Handle Title in ASP.NET Master and Content pages
Meta tags that accurately describes the page contentsKeep links functional and simple
How to Make a Search Friendly Site Dynamic content
Simple URLs with small number of parametershttp://www.somesite.com/view.aspx?ItemID=22http://www.somesite.com/movies/view.aspx
Review site in Lynx text browser to ensure crawlers have a text rendering for high end features
JavaScript, AJAX, Flash, Silverlight
Help the Crawler index the right pagesrobots.txt – specify which directories to include/excludeSitemap – specify page relative priority, change frequency, last modified
Search Enable Your ASP.NET SiteSearchDataSource
Natural binding of UI elements for search inputEnables data binding of search resultsStyle to your website to provide consistent experience
Search ProvidersLive Search (formally MSN Search)Sample code for Index Server, Yahoo, …Look at the QuickStarts on how to write your own search provider
Add Search to an ASP.NET website
Write a custom search providerJonathan HawkinsArchitectASP.NET
demo
<asp:TextBox ID="TextBoxSearch" runat="server"></asp:TextBox><asp:Button ID="ButtonSearch" runat="server" OnClick="ButtonSearch_Click“ Text="Search" /> <asp:SearchDataSource ID="SearchDataSource1" runat="server" > <SelectParameters> <asp:ControlParameter
ControlID="TextBoxSearch" Name="query" PropertyName="Text“ Type="Object" />
</SelectParameters></asp:SearchDataSource> <asp:GridView ID="GridView1" runat="server" DataSourceID="SearchDataSource1"></asp:GridView>
Code: SearchDataSource
Search SitemapsEnable search engine crawlers to find information in your siteSitemaps provide suggestions to search enginesSpecify priority of the URL relative to the other pages in your siteSpecify how frequently the page is likely to changeSpecify last modified date timePartition sitemaps with a sitemap indexSupported by major search enginesSee http://sitemaps.org/protocol.html for details
ASP.NET, Sitemaps and Dynamic DataTurn your ASP.NET navigation sitemap into a search sitemapAdd application dynamic data to search site map
URL to the web pagequery string parametersSitemap priority, change frequency and last modified dateCustomize with databinding and formatting
Turn Navigation Sitemap into Search Sitemap
Add dynamc data to Search SitemapJonathan HawkinsArchitectASP.NET
demo
Search Enabling Silverlight Web Applications
Jonathan HawkinsArchitectASP.NET
demo
Live Search for DevelopersSearch query language
http://search.live.com/docs/help.aspx?t=SEARCH_REF_AdvSrchOperators.htm
Search macros (similar to stored procedures)
http://search.live.com/macros
AJAX web search controlhttp://search.live.com/siteowner
SOAP APIhttp://dev.live.com/livesearch/sdk
Web, Image, News, Phonebook, and MetaTagsSamples, samples, samples
C#, Java, PHP, Ruby, Python, Flash
Commerical Terms of Use
Live Search Supporting Broad Commercial Use
Max Queries/ Day: 25,000
Max Queries/ Second: 10
Best effort service level agreement
Online support: http://forum.microsoft.com
Example
ReferencesWeb Masters
http://help.live.com/help.aspx?project=wl_webmasters
https://siteexplorer.search.yahoo.com
http://www.google.com/webmasters
Developershttp://dev.live.com/LiveSearch http://developer.yahoo.com/search/http://code.google.com/apis/ajaxsearch/web.html
Sitemapshttp://sitemaps.org/protocol.html
Summary
Add Search and SiteMaps to your site today!Live Search
USB Key in your attendee bagLearn more - http://search.live.comFeedback - http://forum.microsoft.com
ASP.NET Futures CTP Download CTP todayLearn more - http://ajax.asp.netFeedback - http://forums.asp.net/
Please fill out your eval
evaluation
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions,
it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Back Up
<microsoft.web.preview> <searchSiteMap enabled="true"> <providers> <add name="Navigation"
type="Microsoft.Web.Preview.Search.AspNetSiteMapSearchSiteMapProvider, Microsoft.Web.Preview"/> <add name="Product" type="ProductSiteMapData, App_Code" targetUrl="Product.aspx“queryStringDataFields="ProductID" /></providers> </searchSiteMap></microsoft.web.preview>
<system.web> <httpHandlers> <add verb="*" path="SearchSiteMaps.axd“ type="Microsoft.Search.SearchSiteMapHandler" validate=“false"/> </httpHandlers></system.web>
public class ProductSiteMapData : DynamicDataSearchSiteMapProvider{ // Return a collection of results. // Use LINQ, ADO.NET, your code to make a collection public override IEnumerable DataQuery() { String connectionString = “…”;
Northwind db = new Northwind(connectionString); Table<Product> Products = db.Products;
var q = from p in Products where p.UnitsInStock > (p.ReorderLevel * 10) select p;
return q; }}
<?xml version="1.0" encoding="utf-8" ?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap> <loc>http://example.com/Northwind/SearchSiteMaps.axd?sitemap=Product</loc> <lastmod>2007-04-03T08:24:00.169Z</lastmod> </sitemap> <sitemap> <loc>http://example.com/Northwind/SearchSiteMaps.axd?sitemap=Category</loc> <lastmod>2007-04-03T08:24:00.169Z</lastmod> </sitemap> <sitemap> <loc>http://example.com/Northwind/SearchSiteMaps.axd?sitemap=Navigation</loc> <lastmod>2007-04-03T08:24:00.169Z</lastmod> </sitemap></sitemapindex>
Site Map Index: SearchSiteMaps.axd
<?xml version="1.0" encoding="utf-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://localhost:52062/Northwind/Product.aspx?ProductId=4</loc> </url> <url> <loc>http://localhost:52062/Northwind/Product.aspx?ProductId=8</loc> </url>…</urlset>
Dynamic Data in the SiteMap
Creating a Custom Search EngineKeywords
contains: inanchor: language:
filetype: inbody: loc:, location:
feed:, hasfeed: intitle: prefer:
meta: inurl: {frsh=100}
macro: ip: {popl=100}
site: {mtch=100}
Symbols
+ & AND
- NOT
| OR
“”
()
http://search.live.com/macros
Open Search Standard InfoOpen Search Standard: http://a9.com/-/spec/opensearch/1.1/
JavaScript: window.external.AddSearchProvider('http://www.nasa.gov/nasa-opensearch.xml');
Configuration File:
<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>NASA Space Image Search</ShortName>
<Description>Search NASA.gov for the latest space photos.</Description>
<Url type="text/html" template="http://www.nasa.gov/search?q={searchTerms}" />
</OpenSearchDescription>