We've recently updated our search functionality on Windows Live Dev. We still use Windows Live search, but instead of using the SOAP API* (our original implementation is described here), we have customized the Windows Live search box and use Search tags to scope the results. Why the change? Primarily, because the Windows Live Search box allowed us to easily add multiple tabs in the results that scoped to different content sources--dev.live.com, the Windows Live SDK on MSDN (more on this below), our Forums, and finally all of WWW. Adding or modifying these scopes is trivial, giving us flexibility going forward.
However, we also liked the nifty AJAX implementation and loved the opportunity to demo the search box to developers. If you haven't looked at the Windows Live search box code, here is the modified version of the configuration script for dev.live.com:
<script type="text/javascript" charset="utf-8">
var WLSearchBoxConfiguration=
{
"global":{
"serverDNS":"search.live.com"
},
"appearance":{
"autoHideTopControl":false,
"width":800,
"height":600
},
"scopes":[
{
"type":"web",
"caption":"Windows Live Dev",
"searchParam":"site:dev.live.com"
}
,
{
"type":"web",
"caption":"Windows Live SDK",
"searchParam":"site:msdn2.microsoft.com/en-us/ meta:search.MScategory(aaaabjbabcbfbgba)"
}
,
{
"type":"web",
"caption":"Forums",
"searchParam":"site:forums.microsoft.com/msdn/ meta:search.MSForums.GroupID(23) OR
site:forums.microsoft.com/msdn/ meta:search.MSForums.ForumID(1062)"
}
,
{
"type":"web",
"caption":"Web",
"searchParam":""
}
]
}
</script>
As you can see, we are using Windows Live search query parameters to set the scoping. For scoping the Windows Live SDK on MSDN and the Windows Live Forums, we used search tags embedded in that content. Eytan Seidan, from the Windows Live search team has a good post in the forums on how to use search tags.
A word about the search tags on MSDN
When MSDN moved the library to the new MSDN2.microsoft.com/library/ system, among the many cool new additions was the automatic assignment of search tags (look for the search.MSCategory tags on any Library page). This is a huge benefit, as we are now able to scope to just the Windows Live docs in the MSDN library--providing a more targeted set of results for you from dev.live.com.
Andy Oakley, Program Manager on the new MSDN Library system wrote up some details about the use of MSCategory for me. I thought some of you might find it interesting and want to experiment with Live Search and the MSCategory search tags on MSDN. Read the full text below, as there is a bit of a trick in finding the correct search tag to use in a query:
What is MSCategory?
MSCategory is a way of automatically attributing content based on its position in the MSDN TOC. It is manifested as a <meta> tag on MSDN online rendered pages which include a value of some eight-character MTPS ID. It is hierarchical and inclusive which means that if a document is tagged at a certain node in the TOC, it is also tagged with all of the MSCategory values of that node’s parent, it’s parent and so on right up to the root of the tree.
How does it work?
MSCategory tags are applied to content just before it is rendered on the MSDN web site. As a page is rendered, the system looks at all of the paths through the TOC from the root right down to the individual page. There may be zero, one or more paths to a given page. For each step in the path (i.e. node in the TOC), the system renders a <meta> tag in the HTML head element with a corresponding value. It does not require any document tagging at author or publish time.
Example:
For the Getting Started with Visual C# page at http://msdn2.microsoft.com/en-us/library/a72418yk.aspx, MTPS renders the following meta tags:
<meta name="MSHAttr" content="MScategory:ms269115" />
<meta name="Search.MScategory" content="ms269115" />
<meta name="MSHAttr" content="MScategory:kx37x362" />
<meta name="Search.MScategory" content="kx37x362" />
<meta name="MSHAttr" content="MScategory:a72418yk" />
<meta name="Search.MScategory" content="a72418yk" />
Each of these pairs of entries correspond to the nodes ‘Visual Studio’, ‘Visual C#’ and the actual page ‘Getting Started with Visual C#’ respectively. The MSHAttr form is used for the MSCOM search crawler, the Search.MScategory form is used by the Windows Live search engine.
At crawl time, the search engine indexes these tags and allows filtering based on their values. It is therefore possible to pick a node in the TOC, add a filter where MSCategory=<MSCategory of node> and the search is effectively constrained to any pages that lie beneath that node in the hierarchy.
Where can I see the MSCategory tags?
Do a View Source on any page rendered on msdn2 and look for the tags like those above, however, those are not the strings you use in an advanced Windows Live query. Use the URL http://msdn2.microsoft.com/en-us/library(d=robot)/ to see the page exactly as the search crawler sees it. Note that MSCategory values are encoded in this format to avoid wordbreaking by the search crawler (this is temporary, and will be reverted to the format above when no longer needed). MScategory values are encoded as follows. Separate the 16 character string into eight pairs. For each pair, if the first character is ‘a’, the following character is literal, if the first character is ‘b’, the following character is a number (counting alphabetically where a=0).
e.g. For Visual J#, the MSCategory value is 7xsxf8e2, while the encoded form is bhaxasaxafbiaebc.
*If you are a fan of the SOAP API, check back periodically to dev.live.com, we'll be posting an updated SDK soon.