<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Chris Bushnell</title>
	<atom:link href="http://cbushnell.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cbushnell.wordpress.com</link>
	<description>Tips from a Sitecore technical writer</description>
	<lastBuildDate>Thu, 22 Sep 2011 12:24:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='cbushnell.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/16e4db880983ecc072811e31f2eba05b?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Chris Bushnell</title>
		<link>http://cbushnell.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://cbushnell.wordpress.com/osd.xml" title="Chris Bushnell" />
	<atom:link rel='hub' href='http://cbushnell.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Adding a Banner to a Report Header</title>
		<link>http://cbushnell.wordpress.com/2010/06/22/adding-a-banner-to-a-report-header/</link>
		<comments>http://cbushnell.wordpress.com/2010/06/22/adding-a-banner-to-a-report-header/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 07:10:46 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Sitecore OMS reports]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=888</guid>
		<description><![CDATA[After you have created your own report color scheme you may want to add a graphic to appear in the report header. In the Stimulsoft Windows Designer, you can add an image to the report header using the watermark property. To add an image to a report header: 1. Select a suitable report and open it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=888&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After you have created your own report color scheme you may want to add a graphic to appear in the report header.</p>
<p>In the Stimulsoft Windows Designer, you can add an image to the report header using the watermark property.</p>
<p>To add an image to a report header:</p>
<p>1. Select a suitable report and open it in the Report Designer. For example, <em>Latest Human Sessions</em>.</p>
<p>2. Select the page</p>
<p>3. In the ribbon, select the Page tab</p>
<p>4. Click Load Image to open the Image dialog box. Browse to an appropriate banner image and then click Close.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/bannerimagedialogbox.png"><img style="display:inline;border:0;" title="banner image dialog box" src="http://cbushnell.files.wordpress.com/2010/06/bannerimagedialogbox_thumb.png?w=264&#038;h=168" border="0" alt="banner image dialog box" width="264" height="168" /></a></p>
<p>The banner is now visible in the report:</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/bannerinreportdesigner.png"><img style="display:inline;border:0;" title="banner in report designer" src="http://cbushnell.files.wordpress.com/2010/06/bannerinreportdesigner_thumb.png?w=500&#038;h=213" border="0" alt="banner in report designer" width="500" height="213" /></a></p>
<p>5. Ensure that you have set the following properties in the Properties panel:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="143" valign="top"><strong>Report Element</strong></td>
<td width="136" valign="top"><strong>Property</strong></td>
<td width="234" valign="top"><strong>Setting</strong></td>
</tr>
<tr>
<td width="143" valign="top">Page</td>
<td width="136" valign="top">Watermark</td>
<td width="234" valign="top">Enabled = True</td>
</tr>
<tr>
<td width="143" valign="top">Page Header</td>
<td width="136" valign="top">Appearance, Brush</td>
<td width="234" valign="top">Empty</td>
</tr>
<tr>
<td width="143" valign="top">Report Title</td>
<td width="136" valign="top">Appearance, Brush</td>
<td width="234" valign="top">Empty</td>
</tr>
<tr>
<td width="143" valign="top"> </td>
<td width="136" valign="top">Border</td>
<td width="234" valign="top">Component Style = None</td>
</tr>
</tbody>
</table>
<p>6. Save your changes and preview the report.</p>
<p>You can now see the background image in the report header.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/bannerinheaderpreview.png"><img style="display:inline;border:0;" title="banner in header preview" src="http://cbushnell.files.wordpress.com/2010/06/bannerinheaderpreview_thumb.png?w=526&#038;h=260" border="0" alt="banner in header preview" width="526" height="260" /></a></p>
<p>To change the transparency of the image:</p>
<p>1. In the Report Designer ribbon, select the Page tab.</p>
<p>2. In the Watermark Image group click Image Transparency.</p>
<p>3. Move the slider control to change the transparency of the image.</p>
<p>4. Save your changes and preview the report.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/888/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/888/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/888/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/888/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/888/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/888/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/888/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/888/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/888/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/888/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/888/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/888/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/888/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/888/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=888&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/06/22/adding-a-banner-to-a-report-header/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/bannerimagedialogbox_thumb.png" medium="image">
			<media:title type="html">banner image dialog box</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/bannerinreportdesigner_thumb.png" medium="image">
			<media:title type="html">banner in report designer</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/bannerinheaderpreview_thumb.png" medium="image">
			<media:title type="html">banner in header preview</media:title>
		</media:content>
	</item>
		<item>
		<title>Changing Hyperlink States using CSS Styles</title>
		<link>http://cbushnell.wordpress.com/2010/06/15/changing-hyperlink-states-using-css-styles/</link>
		<comments>http://cbushnell.wordpress.com/2010/06/15/changing-hyperlink-states-using-css-styles/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 08:56:56 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Sitecore OMS reports]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=820</guid>
		<description><![CDATA[In the report designer, it is easy to change common text styles to suit your chosen color scheme. However, changing hyperlinks states from the blue and purple used in the standard OMS reports is not as straight forward. If you want to change the different states of a hyperlink, there is a workaround that allows [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=820&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the report designer, it is easy to change common text styles to suit your chosen color scheme. However, changing hyperlinks states from the blue and purple used in the standard OMS reports is not as straight forward.</p>
<p>If you want to change the different states of a hyperlink, there is a workaround that allows you to do this by embedding CSS styles into a report header. This is an easy solution to the problem and can also be used for other purposes.</p>
<h2>Create a Link Style Component</h2>
<p>First create a new component style in the Style Designer called Link:</p>
<p>1. Open the <em>Latest Human Sessions</em> report.</p>
<p>2. Open the Style Designer.</p>
<p>3. Create a new component style called <em>Link</em>.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/linkstyle.png"><img style="display:inline;border:0;" title="Link style" src="http://cbushnell.files.wordpress.com/2010/06/linkstyle_thumb.png?w=375&#038;h=302" border="0" alt="Link style" width="375" height="302" /></a></p>
<p>4. Set a different Text Brush color property that contrasts with other text used in this report, and then close the designer.</p>
<p>5. In the <em>Latest Human Sessions</em> report click on the text links that you want to change. If you want to select multiple links, hold down the SHIFT key while you make the selection.</p>
<p>6. Format these links by selecting the <em>Link</em> style in the Style panel.</p>
<p>7. In the ribbon, click Save.</p>
<h2>Create a CSS Style</h2>
<p>1. In the <em>Latest Human Sessions</em> report, drag a text box from the toolbox to the report header.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/hyperlinktextbox.png"><img style="display:inline;border:0;" title="hyperlink text box" src="http://cbushnell.files.wordpress.com/2010/06/hyperlinktextbox_thumb.png?w=354&#038;h=195" border="0" alt="hyperlink text box" width="354" height="195" /></a></p>
<p>2. Double click on the text box to open the Expression Editor.</p>
<p>3. Copy the following CSS code into the Expression Editor:</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6bf38129-e5c7-4eab-9835-5aefcde350e9" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">{</span><span style="color:#800000;">"</span><span style="color:#800000;">&lt;style type='text/css'&gt;a { color:green } a:visited { color:red }&lt;/style&gt;</span><span style="color:#800000;">"</span><span style="color:#000000;">}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>Now every link formatted with the <em>Link</em> style will have the styles contained in this expression applied to them.</p>
<p>4. With the same text box selected, in the Properties panel set the <em>Allow Html tags</em> property to <em>False</em>.</p>
<p>If you do not set this property the changes you made to the hyperlink states may not be visible in the report.</p>
<p>5. In the ribbon, click Save and preview the report.</p>
<p>If you want to remove the underline state from a hyperlink:</p>
<p>1. Open the Expression Editor</p>
<p>2. Add the following expression:</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:0416305c-ccf8-428d-be8c-b7a6b01c2a09" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">a { text</span><span style="color:#000000;">-</span><span style="color:#000000;">decoration:none }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>3. Save your report and preview your new link states in Sitecore Analytics.</p>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/820/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/820/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/820/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/820/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/820/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/820/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/820/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/820/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/820/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/820/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/820/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/820/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/820/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/820/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=820&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/06/15/changing-hyperlink-states-using-css-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/linkstyle_thumb.png" medium="image">
			<media:title type="html">Link style</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/hyperlinktextbox_thumb.png" medium="image">
			<media:title type="html">hyperlink text box</media:title>
		</media:content>
	</item>
		<item>
		<title>Step 4: Testing the Solution</title>
		<link>http://cbushnell.wordpress.com/2010/06/14/step-4-testing-the-solution/</link>
		<comments>http://cbushnell.wordpress.com/2010/06/14/step-4-testing-the-solution/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 12:22:13 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Lucene Search]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=810</guid>
		<description><![CDATA[To test your solution: 1. Ensure that you have the appropriate version of the Sitecore CMS installed 2. Install the update package. Use the Update Installation Wizard tool. 3. Run smart publish. 4. Rebuild the training-master and training-web indexes with the RebuildDatabaseCrawlers script placed under /layouts/scripts. 5. View the Office Products section of the site [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=810&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To test your solution:</p>
<p>1. Ensure that you have the appropriate version of the Sitecore CMS installed</p>
<p>2. Install the update package. Use the Update Installation Wizard tool.</p>
<p>3. Run smart publish.</p>
<p>4. Rebuild the training-master and training-web indexes with the RebuildDatabaseCrawlers script placed under /layouts/scripts.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/rebuildsearchindexes.png"><img style="display:inline;border:0;" title="rebuild search indexes" src="http://cbushnell.files.wordpress.com/2010/06/rebuildsearchindexes_thumb.png?w=386&#038;h=206" border="0" alt="rebuild search indexes" width="386" height="206" /></a></p>
<p>5. View the Office Products section of the site and select an item such as <em>The Standard</em> desk chair.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/testingthestandard.png"><img style="display:inline;border:0;" title="testing the standard" src="http://cbushnell.files.wordpress.com/2010/06/testingthestandard_thumb.png?w=486&#038;h=317" border="0" alt="testing the standard" width="486" height="317" /></a></p>
<p>You can now see all items that are related to the currently selected item.</p>
<p>6. Enter a search term in the search box, such as <em>Desk</em>.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/testingthedesksearch.png"><img style="display:inline;border:0;" title="testing the desk search" src="http://cbushnell.files.wordpress.com/2010/06/testingthedesksearch_thumb.png?w=475&#038;h=373" border="0" alt="testing the desk search" width="475" height="373" /></a></p>
<p>In the Search Results page you can see the all the related items linked to the items found in the search and the categories and brand names related to these items (refinements).</p>
<p>You have now successfully used Lucene and Sitecore.Search to navigate a bidirectional relationships in Sitecore.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/810/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/810/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/810/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/810/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/810/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/810/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/810/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/810/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/810/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/810/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/810/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/810/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/810/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/810/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=810&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/06/14/step-4-testing-the-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/rebuildsearchindexes_thumb.png" medium="image">
			<media:title type="html">rebuild search indexes</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/testingthestandard_thumb.png" medium="image">
			<media:title type="html">testing the standard</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/testingthedesksearch_thumb.png" medium="image">
			<media:title type="html">testing the desk search</media:title>
		</media:content>
	</item>
		<item>
		<title>Step 3: Create a Web Control to Display Related Items</title>
		<link>http://cbushnell.wordpress.com/2010/06/14/step-3-create-a-web-control-to-display-related-items/</link>
		<comments>http://cbushnell.wordpress.com/2010/06/14/step-3-create-a-web-control-to-display-related-items/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 12:12:34 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Lucene Search]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=802</guid>
		<description><![CDATA[Next create a Web control class to display search results on your Web site. In this solution there are three Web controls: RelatedItems.cs SearchResults.cs Facet.cs In this blog post we will only create the first control, RelatedItems.cs and provide the code used to create the facet control. How to Create a Related Items Web Control [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=802&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Next create a Web control class to display search results on your Web site. In this solution there are three Web controls:</p>
<ul>
<li>RelatedItems.cs</li>
<li>SearchResults.cs</li>
<li>Facet.cs</li>
</ul>
<p>In this blog post we will only create the first control, <em>RelatedItems.cs</em> and provide the code used to create the facet control.</p>
<h2>How to Create a Related Items Web Control</h2>
<p> </p>
<h4>RelatedItems.cs</h4>
<p>The purpose of the related items control is to trigger a query that fetches content from the search indexes. It uses the Searcher and the Query Runner classes to return a list of items and then formats the list and displays the results as related items in the side bar of the appropriate product pages.</p>
<p>To create a related items control:</p>
<p>1. Include the following namespaces:</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:113b8494-6b4b-4052-b4af-2fb5a9b9660d" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">namespace</span><span style="color:#000000;"> Starterkit.WebControls

{

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System.Web.UI;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Sitecore.Data.Items;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Sitecore.Links;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System.Collections.Generic;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System.Linq;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Sitecore.Data;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Sitecore.Data.Fields;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Sitecore.Diagnostics;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Sitecore.Training.Index;
</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
</div>
<p>2. Name this Web control RelatedItems.</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:5c4419af-e3da-4917-9e0e-c77156ef6b3f" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">class</span><span style="color:#000000;"> RelatedItems : Sitecore.Web.UI.WebControl</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>3. When you create a class that inherits from a Web control you always need a <em>DoRender</em> method. Create a <em>DoRender</em> method to control the presentation of the related items list. The following code extract shows the entire method.</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:50c0222b-43a5-43ff-b364-61a7176fc3b7" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">protected</span><span style="color:#000000;"> </span><span style="color:#0000ff;">override</span><span style="color:#000000;"> </span><span style="color:#0000ff;">void</span><span style="color:#000000;"> DoRender(HtmlTextWriter output)

{

var categories </span><span style="color:#000000;">=</span><span style="color:#000000;"> from relatedItem </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> GetAllRelations()

group relatedItem by GetDisplayNameById(relatedItem.ParentID) into g

select </span><span style="color:#0000ff;">new</span><span style="color:#000000;"> { CategoryName </span><span style="color:#000000;">=</span><span style="color:#000000;"> g.Key, Items </span><span style="color:#000000;">=</span><span style="color:#000000;"> g };

</span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (categories.Count() </span><span style="color:#000000;">&gt;</span><span style="color:#000000;"> </span><span style="color:#800080;">0</span><span style="color:#000000;">)

{

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;div id="relatedItems"&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.AddAttribute(HtmlTextWriterAttribute.Id, </span><span style="color:#800000;">"</span><span style="color:#800000;">relatedItems</span><span style="color:#800000;">"</span><span style="color:#000000;">);

output.RenderBeginTag(HtmlTextWriterTag.Div);

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;h2&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderBeginTag(HtmlTextWriterTag.H2);

output.Write(</span><span style="color:#800000;">"</span><span style="color:#800000;">Related Categories</span><span style="color:#800000;">"</span><span style="color:#000000;">);

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;/h2&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderEndTag();

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;ul&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderBeginTag(HtmlTextWriterTag.Ul);

</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (var category </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> categories)

{

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;li&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderBeginTag(HtmlTextWriterTag.Li);

output.Write(String.Format(</span><span style="color:#800000;">"</span><span style="color:#800000;">{0} ({1}):</span><span style="color:#800000;">"</span><span style="color:#000000;">, category.CategoryName,

category.Items.Count()));

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;/li&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderEndTag();

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;ul&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderBeginTag(HtmlTextWriterTag.Ul);

</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (var item </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> category.Items)

{

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;li&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderBeginTag(HtmlTextWriterTag.Li);

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;a href='/item.aspx'</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.AddAttribute(HtmlTextWriterAttribute.Href,

LinkManager.GetItemUrl(item));

output.RenderBeginTag(HtmlTextWriterTag.A);

output.Write(item.DisplayName);

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;/a&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderEndTag();

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;/li&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderEndTag();

}

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;/ul&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderEndTag();

}

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;/ul&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderEndTag();

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;/div&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderEndTag();

}

}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>Create a method called <em>GetAllRelations</em>.</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:5c3e1650-3430-4ca1-840c-739a216d54b8" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">protected</span><span style="color:#000000;"> IEnumerable</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">Item</span><span style="color:#000000;">&gt;</span><span style="color:#000000;"> GetAllRelations()</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>This method goes to the multi-list field on the item and fetches all items that are marked as related by reading the value of the multi-list field.</p>
<p>It then creates an instance of the Searcher and calls the <em>Searcher GetRelatedItems byField</em> method which triggers the <em>Searcher</em> and <em>Query Runner</em>.</p>
<p>4. In the <em>GetAllRelations</em> method, use comments to select a Searcher method. Add or remove comments so that only one method can be run at any one time:</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:2861c38a-a5e0-4d9a-885c-8006646ad76e" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#008000;">//</span><span style="color:#008000;">relatedItems.AddRange(searcher.GetItemsByFullTextQuery(ItemIds));</span><span style="color:#008000;">
</span><span style="color:#000000;">
relatedItems.AddRange(searcher.GetRelatedItemsByField(ItemIds, fieldName, </span><span style="color:#0000ff;">true</span><span style="color:#000000;">));

</span><span style="color:#008000;">//</span><span style="color:#008000;">relatedItems.AddRange(searcher.GetRelatedItems(ItemIds));</span><span style="color:#008000;">
</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
</div>
<p>This enables you to easily change the way the control interacts with the Searcher.</p>
<p>5.<em> </em>Create a method called <em>GetDirectItemRelations(string fieldName)</em></p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c21b74be-0a7e-4cca-af41-1c0da9abce36" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">protected</span><span style="color:#000000;"> List</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">Item</span><span style="color:#000000;">&gt;</span><span style="color:#000000;"> GetDirectItemRelations(</span><span style="color:#0000ff;">string</span><span style="color:#000000;"> fieldName)
        {
            var directItemRelations </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">new</span><span style="color:#000000;"> List</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">Item</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">();

            </span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (var itemId </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> ItemIds.Split(</span><span style="color:#0000ff;">new</span><span style="color:#000000;">[] { </span><span style="color:#800000;">"</span><span style="color:#800000;">|</span><span style="color:#800000;">"</span><span style="color:#000000;"> }, 

            StringSplitOptions.RemoveEmptyEntries))
            {
                var item </span><span style="color:#000000;">=</span><span style="color:#000000;"> Sitecore.Context.Database.GetItem(itemId);

                </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (item </span><span style="color:#000000;">!=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">null</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;&amp;</span><span style="color:#000000;">
                    item.Fields[fieldName] </span><span style="color:#000000;">!=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">null</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;&amp;</span><span style="color:#000000;">
                    (FieldTypeManager.GetField(item.Fields[fieldName]) </span><span style="color:#0000ff;">is</span><span style="color:#000000;"> MultilistField))
                {
                    MultilistField relatedItemsField </span><span style="color:#000000;">=</span><span style="color:#000000;"> item.Fields[fieldName];
                    directItemRelations.AddRange(relatedItemsField.GetItems());
                }
            }

            </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> directItemRelations;
        }

            </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> directItemRelations;
        }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>Get all related items and return a list of GUIDS that are pipe separated. Sitecore uses pipe separated lists in the Related Items field to separate GUIDS. In the Content Editor View tab, if you select the raw values field, you can see the pipe separated GUIDS in the RelatedItems field.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/pipeseparatedguids.png"><img style="display:inline;border-width:0;" title="pipe separated guids" src="http://cbushnell.files.wordpress.com/2010/06/pipeseparatedguids_thumb.png?w=577&#038;h=87" border="0" alt="pipe separated guids" width="577" height="87" /></a></p>
</div>
</div>
</div>
</div>
<p>6<em>.</em> Create a method called <em>GetDisplayNameById(ID itemId).</em></p>
<p>This method gets the title or display name for the selected item from the title field and displays it in the control.</p>
<table border="0" cellspacing="0" cellpadding="2" width="593">
<tbody>
<tr>
<td width="200" valign="top"><a href="http://cbushnell.files.wordpress.com/2010/06/standardrelateditems.png"><img style="display:inline;border-width:0;" title="standard related items" src="http://cbushnell.files.wordpress.com/2010/06/standardrelateditems_thumb.png?w=371&#038;h=186" border="0" alt="standard related items" width="371" height="186" /></a></td>
<td width="391" valign="top"> Related Items Web control</td>
</tr>
</tbody>
</table>
<p>7. Save and compile your new Web control.</p>
<h4>Facet.cs</h4>
<p>This control adds the refinements that display <em>Category</em> and <em>Brand Name</em> above the related items control.</p>
<p>The Facet Web control fetches items from the Content Editor, content tree and then gets the URLs of each item. Then it constructs a query in the address bar of the browser.</p>
<p>For example:</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c3d1edbb-d9a7-4d89-b2d7-fa2116377819" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">http://</span><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">your </span><span style="color:#ff0000;">site</span><span style="color:#0000ff;">&gt;</span><span style="color:#000000;">/en/Standard-Items/Search-Results.aspx?search=desk</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/deskinaddressbar.png"><img style="display:inline;border-width:0;" title="desk in address bar" src="http://cbushnell.files.wordpress.com/2010/06/deskinaddressbar_thumb.png?w=447&#038;h=134" border="0" alt="desk in address bar" width="447" height="134" /></a></p>
<p>Code extract to show how the refinements query is constructed:</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:5b57ac0e-f911-48b6-9638-faeb45cb3ec2" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">{

</span><span style="color:#0000ff;">string</span><span style="color:#000000;"> url </span><span style="color:#000000;">=</span><span style="color:#000000;"> LinkManager.GetItemUrl(Sitecore.Context.Item);

var queryStringDictionary </span><span style="color:#000000;">=</span><span style="color:#000000;"> WebUtil.ParseQueryString(WebUtil.GetQueryString());

</span><span style="color:#0000ff;">if</span><span style="color:#000000;">(queryStringDictionary.ContainsKey(FieldName))

queryStringDictionary.Remove(FieldName);

</span><span style="color:#0000ff;">return</span><span style="color:#000000;"> WebUtil.AddQueryString(url </span><span style="color:#000000;">+</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">?</span><span style="color:#800000;">"</span><span style="color:#000000;"> </span><span style="color:#000000;">+</span><span style="color:#000000;"> WebUtil.BuildQueryString(queryStringDictionary, </span><span style="color:#0000ff;">false</span><span style="color:#000000;">), </span><span style="color:#0000ff;">new</span><span style="color:#000000;">[] { FieldName, FieldValue });

}
</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
</div>
<p>AppendFacetURL is called by the following code that controls the presentation of the refinements:</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:35c4c03f-1da1-4077-92ab-188f5b4cdd32" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">{

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;div id="relatedItems"&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.AddAttribute(HtmlTextWriterAttribute.Class, </span><span style="color:#800000;">"</span><span style="color:#800000;">facet</span><span style="color:#800000;">"</span><span style="color:#000000;">);

output.RenderBeginTag(HtmlTextWriterTag.Div);

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;a href='/item.aspx'</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.AddAttribute(HtmlTextWriterAttribute.Href, AppendFacetUrl());

output.RenderBeginTag(HtmlTextWriterTag.A);

output.Write(Name);

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;/a&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderEndTag();

</span><span style="color:#008000;">//</span><span style="color:#008000;">&lt;/div&gt;</span><span style="color:#008000;">
</span><span style="color:#000000;">
output.RenderEndTag();

}

</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<table border="0" cellspacing="0" cellpadding="2" width="600">
<tbody>
<tr>
<td width="200" valign="top"><a href="http://cbushnell.files.wordpress.com/2010/06/searchresultscontrol.png"><img style="display:inline;border-width:0;" title="search results control" src="http://cbushnell.files.wordpress.com/2010/06/searchresultscontrol_thumb.png?w=380&#038;h=247" border="0" alt="search results control" width="380" height="247" /></a></td>
<td width="398" valign="top"> Search Results control with facetted list control</td>
</tr>
</tbody>
</table>
<h4>Search Results.cs</h4>
<p>The Search Results Web control uses the same classes as <em>RelatedItems.cs</em> to display related items and other refinements in the side bar. See the full solution source code to find out how this control has been adapted to display the same related items and facetted list in the side bar.</p>
<table border="0" cellspacing="0" cellpadding="2" width="602">
<tbody>
<tr>
<td width="200" valign="top"><a href="http://cbushnell.files.wordpress.com/2010/06/searchresultscontrolrelateditems.png"><img style="display:inline;border-width:0;" title="search results control related items" src="http://cbushnell.files.wordpress.com/2010/06/searchresultscontrolrelateditems_thumb.png?w=382&#038;h=248" border="0" alt="search results control related items" width="382" height="248" /></a></td>
<td width="400" valign="top"> Search Results control with related items control</td>
</tr>
</tbody>
</table>
</div>
<p>Next step: <a href="http://cbushnell.wordpress.com/2010/06/14/step-4-testing-the-solution/">Testing the Solution</a></p>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/802/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=802&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/06/14/step-3-create-a-web-control-to-display-related-items/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/pipeseparatedguids_thumb.png" medium="image">
			<media:title type="html">pipe separated guids</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/standardrelateditems_thumb.png" medium="image">
			<media:title type="html">standard related items</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/deskinaddressbar_thumb.png" medium="image">
			<media:title type="html">desk in address bar</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/searchresultscontrol_thumb.png" medium="image">
			<media:title type="html">search results control</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/searchresultscontrolrelateditems_thumb.png" medium="image">
			<media:title type="html">search results control related items</media:title>
		</media:content>
	</item>
		<item>
		<title>Step 2: Implement a Query Runner Class</title>
		<link>http://cbushnell.wordpress.com/2010/06/14/step-2-implement-a-query-runner-class/</link>
		<comments>http://cbushnell.wordpress.com/2010/06/14/step-2-implement-a-query-runner-class/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 10:59:44 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Lucene Search]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=790</guid>
		<description><![CDATA[Searcher contains a list of all query methods available to interrogate the search indexes. Query Runner contains the processing logic for each query.     For every method run in Searcher.cs, Query Runner is called behind the scenes. To see how each query is constructed look in QueryRunner.cs. This is also where each query is run.     QueryRunner.cs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=790&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Searcher contains a list of all query methods available to interrogate the search indexes. Query Runner contains the processing logic for each query.    </p>
<p>For every method run in <em>Searcher.cs</em>, Query Runner is called behind the scenes. To see how each query is constructed look in <em>QueryRunner.cs</em>. This is also where each query is run.    </p>
<h4>QueryRunner.cs</h4>
<p>To create a query runner:    </p>
<p>1. First add the following namespaces:    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:2a17663a-e07a-4f09-8c18-1884b73dfa88" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">namespace</span><span style="color:#000000;"> Sitecore.Training.Index

{

</span><span style="color:#0000ff;">#region</span><span style="color:#000000;"> Usings</span><span style="color:#000000;">

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System.Collections.Generic;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System.Linq;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Lucene.Net.Search;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Lucene.Net.Index;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Lucene.Net.QueryParsers;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Lucene.Net.Analysis.Standard;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Search;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Diagnostics;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Data;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Collections;
</span></pre>
<p> </p>
<p>2. Name the class Query Runner    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:69f71d38-151e-48fa-8490-28856145005b" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">class</span><span style="color:#000000;"> QueryRunner : IDisposable</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->    </p>
<p>3. Create the following constructor:    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c626abbb-cf60-4f0d-a382-c29675289e3b" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">public</span><span style="color:#000000;"> QueryRunner(</span><span style="color:#0000ff;">string</span><span style="color:#000000;"> indexId)

{

Index </span><span style="color:#000000;">=</span><span style="color:#000000;"> SearchManager.GetIndex(indexId);

}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->    </p>
<p>This constructor gets the appropriate search index. It calls the <em>SearchManager</em> class with the <em>GetIndex</em> method and uses index as a parameter. The<em> IndexId</em> parameter can refer to either the <em>training master</em> or <em>training web</em> indexes.    </p>
<p>4. Create a property called index:    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:51beed48-4372-4660-8ad2-ec6b698ee830" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">public</span><span style="color:#000000;"> Index Index { </span><span style="color:#0000ff;">get</span><span style="color:#000000;">; </span><span style="color:#0000ff;">set</span><span style="color:#000000;">; }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->    </p>
<p>5. Create two query runner methods. Both of these use the same parameter called <em>query</em> but the type is different.    </p>
<p><em>QueryBase</em> = Sitecore.Search    </p>
<p><em>Query</em> = Lucene.Net</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="328" valign="top"><strong>Query Method</strong>    </td>
<td width="313" valign="top"><strong>Description</strong>    </td>
</tr>
<tr>
<td width="328" valign="top">SearchResultCollection RunQuery(QueryBase query)    </td>
<td width="313" valign="top">Using Sitecore.Search API – this method expects Sitecore queries    </td>
</tr>
<tr>
<td width="328" valign="top">SearchResultCollection RunQuery(Query query)    </td>
<td width="313" valign="top">Using Lucene.Net API – this method expects Lucene queries    </td>
</tr>
</tbody>
</table>
<p>5. Create your search methods (queries). These are the same as the methods listed in <em>Searcher.cs</em>. The table below describes each of these methods in more detail. View the Visual Studio solution to see the full source code for each method.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="346" valign="top"><strong>Method</strong>    </td>
<td width="302" valign="top"><strong>Description</strong>    </td>
</tr>
<tr>
<td width="346" valign="top">GetItemsByFullTextQuery(string query)    </td>
<td width="302" valign="top">Searches through all the text contained in the item fields, including Rich Text fields and meta-data.    </td>
</tr>
<tr>
<td width="346" valign="top">GetRelatedItemsByMultipleFields(string query, SafeDictionary&lt;string&gt; refinements)    </td>
<td width="302" valign="top">Called from the SearchManager.Search() method via Searcher.GetRelatedItemsByMultipleFields:    Get the refinements from the query string:    var refinements =    WebUtil.ParseQueryString(WebUtil.GetQueryString());    </p>
<p>refinements.Remove(&#8220;search&#8221;);    </p>
<p>Pass them on to the searcher:    </p>
<p>var results =    </p>
<p>searcher.GetRelatedItemsByMultipleFields(searchString, refinements);    </p>
<p>This method links to a list of dictionary refinements and adds category and brand as refinements to the search.    </td>
</tr>
<tr>
<td width="346" valign="top">GetRelatedItems(string ids)    </td>
<td width="302" valign="top">Gets all relations without specifying a field.    Get related items by list of Ids and returns a pipe separated list of ids.    </td>
</tr>
<tr>
<td width="346" valign="top">GetRelatedItemsByField(string ids,string fieldName, bool partial)    </td>
<td width="302" valign="top">Extends the <em>GetRelatedItems</em> method by adding more parameters. This method can be used effectively to return items in bidirectional relationships.    </td>
</tr>
<tr>
<td width="346" valign="top">ContainsItemsByFields(string ids,    string fieldName, string fieldValue)    </td>
<td width="302" valign="top">For refinements to work – to check if a category relates to any of the items returned in the search results.    </td>
</tr>
</tbody>
</table>
<p>6. Define the following Clause Construction Helper classes:    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:75a8ec12-6f71-43b4-b0dd-abd8641496dd" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">AddFieldValueClause(BooleanQuery query, </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> fieldName, </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> fieldValue, BooleanClause.Occur occurance)</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:93931829-e4e5-4173-9bb1-c2fe12f2ac57" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">AddPartialFieldValueClause(BooleanQuery query, </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> fieldName, </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> fieldValue)</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:7b1e16ab-80c0-4616-9962-1d337ac793f2" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">AddFullTextClause(BooleanQuery query, </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> searchText)</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:52306472-fc49-43b3-a708-e79607cbabb4" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">ApplyIdFilter(BooleanQuery query, </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> fieldName, </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> filter)</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:79c652fc-0aaf-49ff-b068-70726205f7fe" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">ApplyRelationFilter(BooleanQuery query, </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> ids)</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->    </p>
<p>The Helper classes perform some extra validation on GUIDs before allowing them to be used by the search indexes. All GUIDs are first converted to lowercase and then given short IDs. Lucene also checks for and filters out any stop words. It is necessary to normalize GUIDs in this way to avoid unexpected results when querying.    </p>
<p>7. Return a search index specified by ID.    </p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:7490dc1b-b818-4181-ba91-7851cbae11be" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">static</span><span style="color:#000000;"> Sitecore.Search.Index GetIndex(</span><span style="color:#0000ff;">string</span><span style="color:#000000;"> indexId)

{

</span><span style="color:#0000ff;">return</span><span style="color:#000000;"> SearchManager.GetIndex(indexId);

}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->    </p>
<p>Next Step: <a href="http://cbushnell.wordpress.com/2010/06/14/step-3-create-a-web-control-to-display-related-items/">Creating a Web Control to Display Related Items</a>    </p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/790/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/790/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/790/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/790/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/790/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/790/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/790/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/790/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/790/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/790/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/790/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/790/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/790/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/790/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=790&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/06/14/step-2-implement-a-query-runner-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>
	</item>
		<item>
		<title>Step 1: Implement a Searcher Class</title>
		<link>http://cbushnell.wordpress.com/2010/06/14/step-1-implement-a-searcher-class/</link>
		<comments>http://cbushnell.wordpress.com/2010/06/14/step-1-implement-a-searcher-class/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 09:47:19 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Lucene Search]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=787</guid>
		<description><![CDATA[When you have completed this bidirectional example, if you view an office product or conduct a search of office products, a rendering control is displayed that shows all related items in the side bar of the page. The Searcher and the Query Runner make this possible by invoking a database crawler to search the indexes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=787&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When you have completed this bidirectional example, if you view an office product or conduct a search of office products, a rendering control is displayed that shows all related items in the side bar of the page.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/standardrelateditems1.png"><img style="display:inline;border-width:0;" title="standard related items" src="http://cbushnell.files.wordpress.com/2010/06/standardrelateditems_thumb1.png?w=415&#038;h=216" border="0" alt="standard related items" width="415" height="216" /></a></p>
<p>The Searcher and the Query Runner make this possible by invoking a database crawler to search the indexes for any related items, depending on which Web control is used. The Web control then processes the results and displays them on the Web site.</p>
<p><em>Searcher.cs</em> contains multiple methods that query the indexes in several different ways. The full code for each method is contained in the Query Runner; it is not visible in the Searcher. The Searcher simply contains a list of methods used.</p>
<p>The Searcher can only execute one method at a time. When a method in the Searcher is invoked by the Related Items Web control, the Runner is called. The Runner searches the indexes and sends a list of items to the Searcher used by the Related Items Web control to display related items to the site visitor.</p>
<h4>Searcher.cs</h4>
<p>To create a Searcher:</p>
<p>1. First include the following namespaces:</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:be65b7af-9b22-4fdb-aa4f-8cabfd0579b5" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;overflow:auto;"><span style="color:#0000ff;">namespace</span><span style="color:#000000;"> Sitecore.Training.Index

{

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System.Collections.Generic;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Search;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Data;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Data.Items;

</span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Collections;

</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>2. Name the class <em>Searcher</em>: public class Searcher</p>
<p>3. Create a new instance of the Query Runner property to be used by the Searcher.</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a7637d74-126d-4713-bc24-a1f4f33f7a7f" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">protected</span><span style="color:#000000;"> QueryRunner Runner { </span><span style="color:#0000ff;">get</span><span style="color:#000000;">; </span><span style="color:#0000ff;">set</span><span style="color:#000000;">; }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>4. Create two constructors that are triggered when you run the Searcher. Only one of these constructors should accept parameters to specify which index is used when you conduct a search.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="349" valign="top"><strong>Constructors</strong></td>
<td width="299" valign="top"><strong>Parameters</strong></td>
</tr>
<tr>
<td width="349" valign="top">public Searcher(){Runner = new QueryRunner(Constants.Index.Name);</p>
<p>}</td>
<td width="299" valign="top">() No parametersNo index id specified, so the query runner tries to find the index by calling index.name</td>
</tr>
<tr>
<td width="349" valign="top">public Searcher(string indexId){Runner = new QueryRunner(indexId);</p>
<p>}</td>
<td width="299" valign="top">(string indexId) is specified as the parameter to use to fetch the search index.</td>
</tr>
</tbody>
</table>
<p>5. Define a new region in the code for search methods and then add each method that you want to use. Each search method is basically a query. This example shows the first method in <em>Searcher.cs</em>: GetItemsByFullTextQuery</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:69cdf5ee-b4c1-458d-b3e1-6b62ea5397c8" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">#region</span><span style="color:#000000;"> Searching Methods</span><span style="color:#000000;">

</span><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">virtual</span><span style="color:#000000;"> List</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">Item</span><span style="color:#000000;">&gt;</span><span style="color:#000000;"> GetItemsByFullTextQuery(</span><span style="color:#0000ff;">string</span><span style="color:#000000;"> query)

{

var results </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">new</span><span style="color:#000000;"> List</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">SearchResult</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">(Runner.GetItemsByFullTextQuery(query));

</span><span style="color:#0000ff;">return</span><span style="color:#000000;"> GetItemsFromSearchResult(results);

}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>Search methods are only triggered when the Related Items control calls one. When a search method is called a new instance of the Query Runner is created in the Searcher. The new instance is called <em>Runner</em>.</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:2f7df1a9-10a2-4b40-9db6-d1b339a617f3" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#000000;">var results </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">new</span><span style="color:#000000;"> List</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">SearchResult</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">(Runner.GetItemsByFullTextQuery(query));</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>Runner then searches the indexes and sends back all relevant search results to the method.</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:0714b5c7-6419-4f8e-8697-7efe84681a68" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">return</span><span style="color:#000000;"> GetItemsFromSearchResult(results);</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>The search results list returned to the Searcher is converted by the GetItemsFromSearchResult method into a result set containing items. This method iterates through the list of results and finds the url for each item.</p>
<p>It takes the search results extracted from the index and then stores them in a <em>resultingSet</em> list.</p>
<p>6. Next create a <em>GetItemsFromSearchResult</em> method. In this method the set of items stored in the <em>resultingSet</em> list is returned with the corresponding url so that you can click a link to get the item.</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c971018d-595f-4505-a19f-76e18c1ceea6" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">static</span><span style="color:#000000;"> List</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">Item</span><span style="color:#000000;">&gt;</span><span style="color:#000000;"> GetItemsFromSearchResult(IList</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">SearchResult</span><span style="color:#000000;">&gt;</span><span style="color:#000000;"> searchResults)

{

var resultingSet </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">new</span><span style="color:#000000;"> List</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">Item</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">();

</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (var result </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> searchResults)

{

var uriField </span><span style="color:#000000;">=</span><span style="color:#000000;"> result.Document.GetField(</span><span style="color:#800000;">"</span><span style="color:#800000;">_url</span><span style="color:#800000;">"</span><span style="color:#000000;">);

</span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (uriField </span><span style="color:#000000;">!=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">null</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;&amp;</span><span style="color:#000000;"> </span><span style="color:#000000;">!</span><span style="color:#000000;">String.IsNullOrEmpty(uriField.StringValue()))

{

var itemUri </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">new</span><span style="color:#000000;"> ItemUri(uriField.StringValue());

resultingSet.Add(Context.Database.GetItem(</span><span style="color:#0000ff;">new</span><span style="color:#000000;"> DataUri(itemUri)));

}

}

</span><span style="color:#0000ff;">return</span><span style="color:#000000;"> resultingSet;

}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<h3>Methods and Parameters in the Searcher Class</h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="355" valign="top"><strong>Searcher Methods </strong></td>
<td width="340" valign="top"><strong>Parameters</strong></td>
</tr>
<tr>
<td width="355" valign="top">GetItemsByFullTextQuery(string query)</td>
<td width="340" valign="top">- full text query on a string</td>
</tr>
<tr>
<td width="355" valign="top">GetRelatedItemsByMultipleFields(string query, SafeDictionary&lt;string&gt; refinements)</td>
<td width="340" valign="top">- full text query on a string- the second parameter searches for refinements using <em>SafeDictionary</em>, then creates a list of dictionary refinements – brand = IKEA, Category = Desk etc</td>
</tr>
<tr>
<td width="355" valign="top">GetRelatedItems(string ids)</td>
<td width="340" valign="top">– Ids = returns the Ids of all items</td>
</tr>
<tr>
<td width="355" valign="top">GetRelatedItemsByField(string ids, string fieldName, bool partial)</td>
<td width="340" valign="top">- Ids = Id of the product selected in the Related Items field. For example, the ‘Standard’ product.- fieldname – the related items field name- partial = boolean</td>
</tr>
<tr>
<td width="355" valign="top">ContainsItemsByFields(string ids, string fieldName, string fieldValue)</td>
<td width="340" valign="top">- Applies an ID filter- fieldName,- string fieldValue = Brand e.g. IKEA</td>
</tr>
<tr>
<td width="355" valign="top">GetItemsFromSearchResult(IList&lt;SearchResult&gt; searchResults)</td>
<td width="340" valign="top">- Search result list – for each item in the search result list this method gets the url and creates another list called resultingSet.</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Next Step: <a href="http://cbushnell.wordpress.com/2010/06/14/step-2-implement-a-query-runner-class/">Implementing a Query Runner Class</a></p>
</div>
</div>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/787/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/787/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/787/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=787&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/06/14/step-1-implement-a-searcher-class/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/standardrelateditems_thumb1.png" medium="image">
			<media:title type="html">standard related items</media:title>
		</media:content>
	</item>
		<item>
		<title>Lucene Search and Bidirectional Relationships</title>
		<link>http://cbushnell.wordpress.com/2010/06/14/lucene-search-and-bidirectional-relationships/</link>
		<comments>http://cbushnell.wordpress.com/2010/06/14/lucene-search-and-bidirectional-relationships/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 09:28:31 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Lucene Search]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=786</guid>
		<description><![CDATA[Introduction The term bidirectional refers to navigating the one to many relationships that are common in relational databases. Sitecore often has difficulty finding content items in both directions in a bidirectional relationship, particularly when it has to find a large number of items. In Sitecore there are currently three possible ways to solve the problem [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=786&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>The term bidirectional refers to navigating the <em>one to many</em> relationships that are common in relational databases. Sitecore often has difficulty finding content items in both directions in a bidirectional relationship, particularly when it has to find a large number of items.</p>
<p>In Sitecore there are currently three possible ways to solve the problem of bidirectional relationships:</p>
<ul>
<li>Links Database</li>
<li>Sitecore queries</li>
<li>Lucene Search</li>
</ul>
<p>Lucene Search is by far the most efficient way to handle bidirectional relationships in Sitecore. It can quickly find items in relationships where there are a large number of items without having a significant effect on performance. Ivan Sharamok wrote an interesting blog on the most efficient ways to extract data from Sitecore:  <a title="Working with Lucene Search Index in Sitecore 6" href="http://sitecoregadgets.blogspot.com/2009/10/working-with-lucene-search-index-part-i.html">Working with Lucene Search Index in Sitecore 6</a>.</p>
<p>Sitecore implements a wrapper for Lucene called Sitecore.Search which encapsulates the search functionality in Lucene.</p>
<p>Some of the benefits of using the Sitecore.Search API:</p>
<ul>
<li>Closely integrated with Sitecore</li>
<li>Safe and more secure to use</li>
<li>Enforces good programming practices</li>
<li>Contains classes specifically related to search</li>
</ul>
<h3>Blog Objectives</h3>
<ul>
<li>To provide Sitecore customers and partners with a starting point when attempting to tackle the problem of bidirectional relationships</li>
<li>To explain the functionality of the main classes used in the bidirectional shared source module</li>
<li>To introduce the Sitecore.Search API and to give practical examples of how it can be used to solve a common problem</li>
</ul>
<h3>Prerequisites</h3>
<ul>
<li>Sitecore CMS 6.0 or later</li>
<li>Sitecore Starter Kit – Training Sample Site</li>
<li>Microsoft Visual Studio 2010</li>
</ul>
<h3>Solution Components</h3>
<p>The bidirectional example described in this blog is also available as a shared source module. The module consists of a Sitecore update package and a Visual Studio solution.</p>
<p>Click here to download the module: <a href="http://trac.sitecore.net/BidirectionalLuceneSearch/wiki/WikiStart" target="_blank">Bidirectional Shared Source Module</a></p>
<p><em>The Visual Studio Solution includes:</em></p>
<p><em><a href="http://cbushnell.files.wordpress.com/2010/06/solutioninvisualstudio.png"><img style="display:inline;border-width:0;" title="solution in visual studio" src="http://cbushnell.files.wordpress.com/2010/06/solutioninvisualstudio_thumb.png?w=272&#038;h=309" border="0" alt="solution in visual studio" width="272" height="309" /></a><br />
</em><em>The update package includes:</em></p>
<ul>
<li>RelatedItems.cs – Web control that adds related items to selected product pages.</li>
<li>SearchResults.cs – This includes an update to the existing Search Results Web control to include related items and refinements in the search results.</li>
<li>Facet.cs – The facet Web control that adds refinements to the search results.</li>
<li>Facet items for Brand Name and Category added to the Meta-Data folder in the content tree:</li>
</ul>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/facetitems.png"><img style="display:inline;border-width:0;" title="facet items" src="http://cbushnell.files.wordpress.com/2010/06/facetitems_thumb.png?w=261&#038;h=295" border="0" alt="facet items" width="261" height="295" /></a></p>
<ul>
<li>The package adds a new field called <em>Brand</em> to the Product Category template:</li>
</ul>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/brandfieldtemplate.png"><img style="display:inline;border-width:0;" title="brand field template" src="http://cbushnell.files.wordpress.com/2010/06/brandfieldtemplate_thumb.png?w=545&#038;h=160" border="0" alt="brand field template" width="545" height="160" /></a></p>
<p>This blog does not cover how to create all the component parts of this solution. I aim to focus on the more complex components such as the Searcher and the Query Runner (<em>Searcher.cs</em> and <em>Query Runner.cs</em>) and will break the code in these classes down into smaller chunks. It is in these classes that you can see the Sitecore.Search API being used to solve the problem of bidirectional relationships.</p>
<p>The example in this blog is just one solution and there are many other ways to solve the same problem. For example, in your own solution you may want to create your own Database Crawler or create your own config include file settings. The settings contained in these files can vary greatly from one solution to another and it is possible to use the Sitecore.Search API to create your own crawler and config include files.</p>
<h3>Steps</h3>
<p>To create this solution, first download the shared source module and then follow these steps:</p>
<p>1. Implement a Searcher Class</p>
<p>2. Implement a Query Runner Class</p>
<p>3. Create a Rendering Control</p>
<p>4. Create a Facet Control</p>
<p>Next step: <a href="http://cbushnell.wordpress.com/2010/06/14/step-1-implement-a-searcher-class/">Implement a Searcher Class</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/786/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/786/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/786/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/786/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/786/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/786/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/786/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/786/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/786/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/786/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/786/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/786/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/786/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/786/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=786&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/06/14/lucene-search-and-bidirectional-relationships/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/solutioninvisualstudio_thumb.png" medium="image">
			<media:title type="html">solution in visual studio</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/facetitems_thumb.png" medium="image">
			<media:title type="html">facet items</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/brandfieldtemplate_thumb.png" medium="image">
			<media:title type="html">brand field template</media:title>
		</media:content>
	</item>
		<item>
		<title>Changing Report Styles using the Properties Panel</title>
		<link>http://cbushnell.wordpress.com/2010/06/07/changing-report-styles-using-the-properties-panel/</link>
		<comments>http://cbushnell.wordpress.com/2010/06/07/changing-report-styles-using-the-properties-panel/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 05:43:49 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Sitecore OMS reports]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=740</guid>
		<description><![CDATA[In the Stimulsoft Report Designer (Web or Windows versions) some presentation settings and styles can only be changed using the properties panel. These include: Changing background color of a report – Appearance, Brush, Color Positioning report elements – Position controls the positioning of report components Adding hyperlinks – Behavior, Interaction, Hyperlink Embedding HTML tags – [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=740&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the Stimulsoft Report Designer (Web or Windows versions) some presentation settings and styles can only be changed using the properties panel.</p>
<p>These include:</p>
<ul>
<li>Changing background color of a report – Appearance, Brush, Color</li>
<li>Positioning report elements – Position controls the positioning of report components</li>
<li>Adding hyperlinks – Behavior, Interaction, Hyperlink</li>
<li>Embedding HTML tags – Text Additional, Allow HTML tags – allows HTML to be embedded in the report</li>
<li>Behavior – settings such as Print on all Pages or Printable = <em>True</em>. Some report elements are not displayed unless these properties are set correctly.</li>
</ul>
<p>Two quick examples of how to use report properties:</p>
<ul>
<h2>Changing the Report Background Color</h2>
<p>1. Select a report such as <em>Latest Human Sessions</em>.</ul>
<ul><a href="http://cbushnell.files.wordpress.com/2010/06/selectpage1.png"><img style="display:inline;border:0;" title="select page" src="http://cbushnell.files.wordpress.com/2010/06/selectpage_thumb1.png?w=378&#038;h=246" border="0" alt="select page" width="378" height="246" /></a></ul>
<ul>2. Select the report page. To select the page, click the white border around the edge of the report.</ul>
<ul>3. With the page selected, open the Properties panel and expand Brush.</ul>
<ul><a href="http://cbushnell.files.wordpress.com/2010/06/backgroundcolorproperty1.png"><img style="display:inline;border:0;" title="background color property" src="http://cbushnell.files.wordpress.com/2010/06/backgroundcolorproperty_thumb1.png?w=378&#038;h=258" border="0" alt="background color property" width="378" height="258" /></a></ul>
<ul>4. Select a color from the drop-down menu. For example, <em>Light Grey</em>.</ul>
<ul><a href="http://cbushnell.files.wordpress.com/2010/06/reportcolorchanged1.png"><img style="display:inline;border:0;" title="report color changed" src="http://cbushnell.files.wordpress.com/2010/06/reportcolorchanged_thumb1.png?w=378&#038;h=211" border="0" alt="report color changed" width="378" height="211" /></a></ul>
<ul>5. Save your changes and preview the report.</ul>
<p><strong>Note</strong></p>
<p>If the background color is still not visible check the <em>Border</em> property of the report.</p>
<p>If the border property is set to <em>None</em>, then the background color will not be visible when you preview the report.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/bordersetting1.png"><img style="display:inline;border:0;" title="border setting" src="http://cbushnell.files.wordpress.com/2010/06/bordersetting_thumb1.png?w=312&#038;h=141" border="0" alt="border setting" width="312" height="141" /></a></p>
<p>Apply a border to at least one side of the report.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/backgroundborderproperty1.png"><img style="display:inline;border:0;" title="background-border property" src="http://cbushnell.files.wordpress.com/2010/06/backgroundborderproperty_thumb1.png?w=266&#038;h=270" border="0" alt="background-border property" width="266" height="270" /></a></p>
<p>Click OK and preview your report again. You should now see the background color that you selected.</p>
<h2>Using the Position Property</h2>
<p>1. In the <em>Latest Human Sessions</em> report, select a text element, for example the timestamp in the report header.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/positionproperty.png"><img style="display:inline;border:0;" title="position property" src="http://cbushnell.files.wordpress.com/2010/06/positionproperty_thumb.png?w=457&#038;h=174" border="0" alt="position property" width="457" height="174" /></a></p>
<p>2. Open another report that uses the same text element, such as <em>Leads Executive</em>.</p>
<p>3. If you want the timestamp control to be positioned in the same in both reports, then check the position property.</p>
<p>4. Select a text element and enter a value in one or more of the position properties.</p>
<p>5. Save your changes and preview the report in Sitecore Analytics.</p>
<p>The Position property can be very useful if you want to have precise control over the positioning of text, links and images.</p>
<p>Next post: Changing Hyperlink States using CSS Styles</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/740/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=740&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/06/07/changing-report-styles-using-the-properties-panel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/selectpage_thumb1.png" medium="image">
			<media:title type="html">select page</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/backgroundcolorproperty_thumb1.png" medium="image">
			<media:title type="html">background color property</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/reportcolorchanged_thumb1.png" medium="image">
			<media:title type="html">report color changed</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/bordersetting_thumb1.png" medium="image">
			<media:title type="html">border setting</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/backgroundborderproperty_thumb1.png" medium="image">
			<media:title type="html">background-border property</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/positionproperty_thumb.png" medium="image">
			<media:title type="html">position property</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating and Re-using Styles</title>
		<link>http://cbushnell.wordpress.com/2010/05/27/creating-and-re-using-styles/</link>
		<comments>http://cbushnell.wordpress.com/2010/05/27/creating-and-re-using-styles/#comments</comments>
		<pubDate>Thu, 27 May 2010 09:17:28 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Sitecore OMS reports]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=656</guid>
		<description><![CDATA[To illustrate how to create styles in an OMS report we will change the heading in the Latest Human Sessions Report in Sitecore Analytics. Important Open the Latest Sessions.mrt file in the report designer. Remember that Latest Human Sessions is the base report for all the following reports: Latest Human Sessions, Latest Company Sessions, Latest [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=656&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To illustrate how to create styles in an OMS report we will change the heading in the <em>Latest Human Sessions</em> Report in Sitecore Analytics.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/latesthumansessionsexample1.png"><img style="display:inline;border-width:0;" title="Latest Human Sessions example" src="http://cbushnell.files.wordpress.com/2010/06/latesthumansessionsexample_thumb1.png?w=492&#038;h=262" border="0" alt="Latest Human Sessions example" width="492" height="262" /></a></p>
<p><strong>Important<br />
</strong>Open the Latest Sessions.mrt file in the report designer. Remember that Latest Human Sessions is the base report for all the following reports: <em>Latest Human Sessions</em>, <em>Latest Company Sessions</em>, <em>Latest ISP Sessions</em> and <em>Unidentified Sessions</em></p>
<p>If you change the style in any of these reports you will change the styles for all these reports. Therefore it is good practice to first make a copy of the report file and save it to your own folder. This prevents you from over writing other reports.</p>
<h3>How to Create a New Style</h3>
<p>In the Style Designer, there are three different styles to choose from:</p>
<ul>
<li>Component Style</li>
<li>Chart Style</li>
<li>Cross Tab Style</li>
</ul>
<p>To create a new style to format the report header title:</p>
<p>1. Click <strong>Add Style</strong> and then select <strong>Component</strong>. You can use component styles to format reports that contain mainly text.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/typesofstryles.png"><img style="display:inline;border-width:0;" title="types of stryles" src="http://cbushnell.files.wordpress.com/2010/06/typesofstryles_thumb.png?w=244&#038;h=161" border="0" alt="types of stryles" width="244" height="161" /></a></p>
<p>2. In the <strong>Name</strong> field, enter <em>MyStyle1 </em>or a name of your choice.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/mystyle1.png"><img style="display:inline;border-width:0;" title="my style 1" src="http://cbushnell.files.wordpress.com/2010/06/mystyle1_thumb.png?w=338&#038;h=273" border="0" alt="my style 1" width="338" height="273" /></a></p>
<p>3. Expand <strong>Text Brush</strong> and select the color <em>Dark Grey</em>.</p>
<p>4. Expand <strong>Brush</strong> and select the color <em>Light Grey.</em> This changes the background color behind the heading.</p>
<p>5. Expand <strong>Font</strong>, select <strong>Font Size</strong> and enter the value <em>21</em>.</p>
<p>6. In the Style Designer, click <strong>Close</strong>.</p>
<p>7. In your chosen report, select the report header.</p>
<p>8. In the Report Designer ribbon <strong>Style</strong> panel, select the style you just created.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/applyingastyle.png"><img style="display:inline;border-width:0;" title="applying a style" src="http://cbushnell.files.wordpress.com/2010/06/applyingastyle_thumb.png?w=541&#038;h=241" border="0" alt="applying a style" width="541" height="241" /></a></p>
<p>9. In <strong>Sitecore Analytics</strong>, refresh the <em>Latest Human Sessions</em> report and view the new in the report header.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/componentstylepreview.png"><img style="display:inline;border-width:0;" title="component style preview" src="http://cbushnell.files.wordpress.com/2010/06/componentstylepreview_thumb.png?w=485&#038;h=325" border="0" alt="component style preview" width="485" height="325" /></a></p>
<p>You have now created and applied a new component style to a report.</p>
<h3>Saving and Re-using Styles</h3>
<p>Save Stimulsoft styles as a .sts file.</p>
<h4>How to Save Styles</h4>
<p>1. Open the Style Designer.</p>
<p>2. Click <em>Save Style</em></p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/savestyle.png"><img style="display:inline;border-width:0;" title="Save style" src="http://cbushnell.files.wordpress.com/2010/06/savestyle_thumb.png?w=308&#038;h=183" border="0" alt="Save style" width="308" height="183" /></a></p>
<p>3. In the <strong>Save Style</strong> dialog box, you can see any existing style files.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/savestylesdialogbox.png"><img style="display:inline;border-width:0;" title="save styles dialog box" src="http://cbushnell.files.wordpress.com/2010/06/savestylesdialogbox_thumb.png?w=472&#038;h=271" border="0" alt="save styles dialog box" width="472" height="271" /></a></p>
<p>4. Give your style a name such as <em>MyStyles</em> and click <strong>Save</strong><em>.</em></p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/mystyles.png"><img style="display:inline;border-width:0;" title="my styles" src="http://cbushnell.files.wordpress.com/2010/06/mystyles_thumb.png?w=469&#038;h=270" border="0" alt="my styles" width="469" height="270" /></a></p>
<p>You can see <em>MyStyles</em> added to the list of available styles.</p>
<h4>How to Import Styles into another Report</h4>
<p>1. Open a report, such as <em>Metrics</em>.</p>
<p>2. Open the Style Designer.</p>
<p>3. Click <strong>Open Style</strong>.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/openstyle.png"><img style="display:inline;border-width:0;" title="open style" src="http://cbushnell.files.wordpress.com/2010/06/openstyle_thumb.png?w=244&#038;h=125" border="0" alt="open style" width="244" height="125" /></a></p>
<p>4. Select the style you want to open from the <strong>Open Style</strong> dialog box, for example <em>MyStyles</em>.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/06/openstyledialog.png"><img style="display:inline;border-width:0;" title="open style dialog" src="http://cbushnell.files.wordpress.com/2010/06/openstyledialog_thumb.png?w=453&#038;h=259" border="0" alt="open style dialog" width="453" height="259" /></a></p>
<p><strong>Note<br />
</strong>If the styles contained in the .sts file have the same names as in the existing report, they will automatically overwrite all the styles contained in that report. If the component style names are different, you must apply each style manually to the elements in the report that you want to change.</p>
<p>Next post: <a href="http://cbushnell.wordpress.com/2010/06/07/changing-report-styles-using-the-properties-panel">Changing Report Styles using the Properties Panel</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/656/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=656&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/05/27/creating-and-re-using-styles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/latesthumansessionsexample_thumb1.png" medium="image">
			<media:title type="html">Latest Human Sessions example</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/typesofstryles_thumb.png" medium="image">
			<media:title type="html">types of stryles</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/mystyle1_thumb.png" medium="image">
			<media:title type="html">my style 1</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/applyingastyle_thumb.png" medium="image">
			<media:title type="html">applying a style</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/componentstylepreview_thumb.png" medium="image">
			<media:title type="html">component style preview</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/savestyle_thumb.png" medium="image">
			<media:title type="html">Save style</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/savestylesdialogbox_thumb.png" medium="image">
			<media:title type="html">save styles dialog box</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/mystyles_thumb.png" medium="image">
			<media:title type="html">my styles</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/openstyle_thumb.png" medium="image">
			<media:title type="html">open style</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/06/openstyledialog_thumb.png" medium="image">
			<media:title type="html">open style dialog</media:title>
		</media:content>
	</item>
		<item>
		<title>Styling OMS Reports</title>
		<link>http://cbushnell.wordpress.com/2010/05/27/styling-oms-reports/</link>
		<comments>http://cbushnell.wordpress.com/2010/05/27/styling-oms-reports/#comments</comments>
		<pubDate>Thu, 27 May 2010 08:17:37 +0000</pubDate>
		<dc:creator>cbushnell</dc:creator>
				<category><![CDATA[Sitecore OMS reports]]></category>

		<guid isPermaLink="false">https://cbushnell.wordpress.com/?p=653</guid>
		<description><![CDATA[Introduction If you want to change the look and feel of the standard OMS reports, there are several things you can do. You can use the Reports.Web Designer to make changes to text, color, and font style. However, there are some formatting tasks that are a little more difficult to achieve. For example, changing the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=653&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h4>Introduction</h4>
<p>If you want to change the look and feel of the standard OMS reports, there are several things you can do.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/05/humansessionsexample1.png"><img style="display:inline;border:0;" title="human sessions example" src="http://cbushnell.files.wordpress.com/2010/05/humansessionsexample_thumb1.png?w=504&#038;h=250" border="0" alt="human sessions example" width="504" height="250" /></a></p>
<p>You can use the Reports.Web Designer to make changes to text, color, and font style. However, there are some formatting tasks that are a little more difficult to achieve. For example, changing the colors associated with the different states of a hyperlink, changing the colors in a chart or knowing how to create a style sheet that you can re-use in multiple reports.</p>
<p>In this series of blogs I will explain how to achieve some of these tasks. There is also existing Stimulsoft and Sitecore documentation that covers the basics:</p>
<ul>
<li>The Report Designer Cookbook &#8211; available on the Sitecore Developers Network in the OMS section</li>
<li>Stimulsoft User Manual &#8211; available for download from the Stimulsoft Web site &#8211; <a title="http://www.stimulsoft.com/Documentation.aspx" href="http://www.stimulsoft.com/Documentation.aspx">http://www.stimulsoft.com/Documentation.aspx</a></li>
</ul>
<p>Tools available that you can use for designing OMS reports:</p>
<ul>
<li>Stimulsoft Reports.Web Designer – Flash based designer available in each report. This is built into Sitecore Analytics and is a standard part of the OMS.</li>
<li>Stimulsoft Windows Designer – This is a Windows application. Download the free demo from Stimulsoft Web site and install it on your computer. <a title="http://www.stimulsoft.com/downloads.aspx" href="http://www.stimulsoft.com/downloads.aspx">http://www.stimulsoft.com/downloads.aspx</a></li>
</ul>
<p><strong>Note<br />
</strong>If you install the Stimulsoft Windows Designer ensure that you are using the correct version. Sitecore currently uses version 2009.1.400. If you use a more recent version of the report designer some properties may not render in Sitecore Analytics.</p>
<h4>The Stimulsoft Style Designer</h4>
<p>The Stimulsoft Report Designer Style Designer is the main tool you will use when working with report styles. The Style Designer allows you to create component, chart and cross tab styles and these work a bit like Microsoft Word styles. To apply a style you simply select the text element that you want to change and then in the Style group, click on the style that you want to use.</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/05/styledesignerwindow1.png"><img style="display:inline;border:0;" title="style designer window" src="http://cbushnell.files.wordpress.com/2010/05/styledesignerwindow_thumb1.png?w=347&#038;h=280" border="0" alt="style designer window" width="347" height="280" /></a> </p>
<p>Each report has its own set of styles which are contained in a styles .sts file. This file can be found in the same Web site folder as the report definition .mrt files.</p>
<p>wwwroot\&lt;website_name&gt;\WebSite\sitecore\shell\Applications\Analytics\Reports\Styles.sts</p>
<p><strong>Advantages of the Style Designer</strong></p>
<ul>
<li>Quick and easy to create and reuse styles</li>
<li>You can easily create styles for charts</li>
<li>HTML and CSS style tags can be embedded into reports</li>
</ul>
<p><strong>Limitations of the Style Designer</strong></p>
<ul>
<li>You cannot control all styles with the Style Designer. You must use the properties panel to control some style settings such as page background color.</li>
<li>You cannot create a single style file to apply to all reports. If you have saved a style file and want to use it in more than one report, you must import it manually into each report.</li>
<li>CSS style sheets are not supported, although you can embed CSS style tags in the report header. You cannot create a CSS style sheet and link to it from all reports. You must use Stimulsoft styles.</li>
</ul>
<p><strong>Stimulsoft Style Files</strong></p>
<p>Each report has a Stimulsoft style sheet associated with it. Stimulsoft styles are defined in an XML file that cannot be edited. You should only change the contents of an .sts file using the interface in the Style Designer.</p>
<p>Extract from Styles.sts showing one of the styles defined on odd and even rows:</p>
<p><a href="http://cbushnell.files.wordpress.com/2010/05/extractfromstylexmlfile.png"><img style="display:inline;border-width:0;" title="extract from style xml file" src="http://cbushnell.files.wordpress.com/2010/05/extractfromstylexmlfile_thumb.png?w=551&#038;h=139" border="0" alt="extract from style xml file" width="551" height="139" /></a> </p>
<p>Each report definition file (mrt file) contains a copy of the style XML code in the source code. Therefore it is not possible or desirable to change the contents of the .sts and change the format of all reports.</p>
<p>You cannot use Stimulsoft styles in the same way as cascading style sheets. If you change a style which is used across multiple reports you can only update elements in the report that you are working on. To import a style file (.sts file) into another report use the Style Designer, <em>Open Style</em> button to find the saved style file then click <em>Open </em>to import it into the report.</p>
<p>Next post: <a title="Creating and Re-using Styles" href="http://cbushnell.wordpress.com/2010/05/27/creating-and-re-using-styles/">Creating and Re-using Styles</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cbushnell.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cbushnell.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cbushnell.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cbushnell.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cbushnell.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cbushnell.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cbushnell.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cbushnell.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cbushnell.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cbushnell.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cbushnell.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cbushnell.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cbushnell.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cbushnell.wordpress.com/653/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cbushnell.wordpress.com&amp;blog=9791478&amp;post=653&amp;subd=cbushnell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cbushnell.wordpress.com/2010/05/27/styling-oms-reports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5c6495ef08d15440e64b4ec73673844?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cbushnell</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/05/humansessionsexample_thumb1.png" medium="image">
			<media:title type="html">human sessions example</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/05/styledesignerwindow_thumb1.png" medium="image">
			<media:title type="html">style designer window</media:title>
		</media:content>

		<media:content url="http://cbushnell.files.wordpress.com/2010/05/extractfromstylexmlfile_thumb.png" medium="image">
			<media:title type="html">extract from style xml file</media:title>
		</media:content>
	</item>
	</channel>
</rss>
