<?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>Brian Pedersen's Sitecore and .NET Blog</title>
	<atom:link href="http://briancaos.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://briancaos.wordpress.com</link>
	<description>A developer oriented blog about Sitecore, C#, ASP.NET and web related issues</description>
	<lastBuildDate>Tue, 31 Jan 2012 12:32:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='briancaos.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Brian Pedersen's Sitecore and .NET Blog</title>
		<link>http://briancaos.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://briancaos.wordpress.com/osd.xml" title="Brian Pedersen&#039;s Sitecore and .NET Blog" />
	<atom:link rel='hub' href='http://briancaos.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Sitecore.Diagnostics.Assert statements</title>
		<link>http://briancaos.wordpress.com/2012/01/20/sitecore-diagnostics-assert-statements/</link>
		<comments>http://briancaos.wordpress.com/2012/01/20/sitecore-diagnostics-assert-statements/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 09:04:57 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[General .NET]]></category>
		<category><![CDATA[Sitecore 6]]></category>
		<category><![CDATA[ArgumentNotNull]]></category>
		<category><![CDATA[Assert]]></category>
		<category><![CDATA[Diagnostics]]></category>
		<category><![CDATA[Exceptions]]></category>
		<category><![CDATA[IsNotNull]]></category>
		<category><![CDATA[Sitecore]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=930</guid>
		<description><![CDATA[Recently I was corrected by my colleague Alan Coates about my use of Assert statements in my code, which gave me the opportunity to write this article. Sitecore has a fundamental Assert (Sitecore.Diagnostics.Assert) namespace which differs fundamentally from the .NET Debug.Assert that it actually thows an exception if the asserted condition is false. Asserting your code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=930&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I was corrected by my colleague <a href="http://www.pentia.dk/Pentia/Medarbejdere" target="_blank">Alan Coates</a> about my use of <a href="http://en.wikipedia.org/wiki/Assertion_(computing)" target="_blank">Assert</a> statements in my code, which gave me the opportunity to write this article.</p>
<p>Sitecore has a fundamental <strong>Assert</strong> (Sitecore.Diagnostics.Assert) namespace which differs fundamentally from the .NET <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.debug.assert(v=vs.71).aspx" target="_blank">Debug.Assert</a> that it actually thows an exception if the asserted condition is false. Asserting your code is a fast way of checking that conditions are met in a function before executing it:</p>
<p><pre class="brush: csharp;">void Page_Load(object sender, System.EventArgs e)
{
  DoStuff(null);
}

private void DoStuff(Item item)
{
  Sitecore.Diagnostics.Assert.ArgumentNotNull(item, &quot;item&quot;); // Assertion
  Response.Write(item.Paths.FullPath);
}
</pre></p>
<p>The example above throws an <a href="http://msdn.microsoft.com/en-us/library/system.argumentnullexception.aspx" target="_blank">ArgumentNullException</a> if the <strong>item</strong> parameter is null, and it even formats the exception message like this:</p>
<p style="padding-left:30px;"><em>Value cannot be null. </em><br />
<em>Parameter name: item </em></p>
<p>Sitecore contains different Assert statements which thows different exceptions. In the example above I could have used the <strong>IsNotNull</strong> statement instead:</p>
<p><pre class="brush: csharp;">private void DoStuff(Item item)
{
  Sitecore.Diagnostics.Assert.IsNotNull(item, &quot;item&quot;);
  Response.Write(item.Paths.FullPath);
}
</pre></p>
<p>But I would then return an <a href="http://msdn.microsoft.com/en-us/library/system.invalidoperationexception.aspx" target="_blank">InvalidOperationException</a> and the exception message would not have been formatted for me, and I would have to write the complete exception message myself:</p>
<p><pre class="brush: csharp;">private void DoStuff(Item item)
{
  Sitecore.Diagnostics.Assert.IsNotNull(item, &quot;The parameter 'item' is null&quot;);
  Response.Write(item.Paths.FullPath);
}
</pre></p>
<p>There are several function to choose from, each of thise returns different exceptions when the condition is not met:</p>
<ul>
<li><strong>AreEqual</strong> return an <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.server.userprofiles.invalidvalueexception.aspx" target="_blank">InvalidValueException</a>. You have to write the exception message yourself (for example &#8220;a is not equal to b&#8221;)</li>
<li><strong>ArgumentCondition</strong>, <strong>ArgumentNotNull</strong>, <strong>ArgumentNotNullOrEmpty</strong> return an <a href="http://msdn.microsoft.com/en-us/library/system.argumentexception.aspx" target="_blank">ArgumentException</a>, pre-formatted for you (see the examples above).</li>
<li><strong>CanRunApplication</strong> return an <em>AccessDeniedException</em> if the user does not have access to the application stated in the parameter (this is probably mostly used internally)</li>
<li><strong>HasAccess</strong> also returns an <em>AccessDeniedException</em> if the condition is not met.</li>
<li><strong>IsEditing</strong> returns an <em>EditingNotAllowedException</em> if the item in the parameter is not in editing mode.</li>
<li><strong>IsFalse, IsNotNull, IsNotNullOrEmpty, IsNull </strong>and<strong> IsTrue </strong>return an <a href="http://msdn.microsoft.com/en-us/library/system.invalidoperationexception.aspx" target="_blank">InvalidOperationException</a> if the condition is not met. You have to format the exception message yourself.</li>
<li><strong>ReflectionObjectCreated</strong> returns an <em>UnknownTypeException</em> if the condition is not met (also most an internal function I guess).</li>
<li><strong>Required</strong> returns an <em>RequiredObjectIsNullException</em> when condition is not met. You have to format the message yourself.</li>
<li><strong>ResultNotNull</strong> is basically a <a href="http://msdn.microsoft.com/en-us/library/ms379564(v=vs.80).aspx" target="_blank">generic</a> version of <strong>ArgumentNotNull</strong> returning the message &#8220;Post condition failed&#8221; when condition is not met.</li>
</ul>
<p>if you look in the Sitecore source code you will notice that basically every Sitecore function asserts all parameters before executing the function, and so should you.</p>
<p>But remember the exception handling as well. Asserting parameters is good practise, but crashing a page because a simple condition is not met is not. For example, if you use a dictionary to look for text strings in Sitecore, you should assert that the dictionaty item is present in Sitecore before returning a value. But you should handle the exception nicely in your domain code so the entire page does not crash just because a dictionary text is missing.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/930/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=930&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2012/01/20/sitecore-diagnostics-assert-statements/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>
	</item>
		<item>
		<title>XElement get default values using extension methods</title>
		<link>http://briancaos.wordpress.com/2012/01/09/xelement-get-default-values-using-extension-methods/</link>
		<comments>http://briancaos.wordpress.com/2012/01/09/xelement-get-default-values-using-extension-methods/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 10:41:12 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[General .NET]]></category>
		<category><![CDATA[Default values]]></category>
		<category><![CDATA[Extension Methods]]></category>
		<category><![CDATA[XElement]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XmlElement]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=919</guid>
		<description><![CDATA[I often work with dynamic XML documents which might or might not contain the element, field or attribute that I am looking for. The Standard .NET XElement class is pretty strict (as it should be) and returns a null reference execption if you ask for the value of an element that is not there: In [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=919&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I often work with dynamic <a href="http://www.xml.com/" target="_blank">XML</a> documents which might or might not contain the element, field or attribute that I am looking for. The Standard .NET <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.aspx" target="_blank">XElement</a> class is pretty strict (as it should be) and returns a <a href="http://msdn.microsoft.com/en-us/library/system.nullreferenceexception.aspx" target="_blank">null reference execption</a> if you ask for the value of an element that is not there:</p>
<p><pre class="brush: xml;">&lt;employees&gt;
 &lt;employee id=&quot;bp&quot;&gt;
   &lt;name&gt;Brian&lt;/name&gt;
 &lt;/employee&gt;
 &lt;employee id=&quot;ap&quot;&gt;
   &lt;name&gt;Anita&lt;/name&gt;
   &lt;position&gt;CEO&lt;/position&gt;
 &lt;/employee&gt;
&lt;/employees&gt;</pre></p>
<p>In the example above I can look for the <em>position</em> element for employee <strong>AP</strong>, but not for employee <strong>BP</strong>. Instead of building my exception handling every time I ask for the <em>position</em> element, I have built a set of <a href="http://msdn.microsoft.com/en-us/library/bb383977.aspx" target="_blank">extension methods</a> that take care of this.</p>
<p><strong>Extension methods 1 and 2: SafeValue and SafeAttribute</strong></p>
<p>The following methods allows me to return a default value if the value of either an element or an attribute is not present:</p>
<p><pre class="brush: csharp;">using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Linq;

namespace MyCode.Extensions
{
  public static class XElementExtension
  {
     public static string SafeValue(this XElement element, string defaultValue)
     {
       if (element == null)
         return defaultValue;
       if (element.Value == null)
         return defaultValue;
       return element.Value;
     }

     public static string SafeAttribute(this XElement element, XName name, string defaultValue)
     {
       if (element == null)
         return defaultValue;
       if (element.Attribute(name) == null)
         return defaultValue;
       if (element.Attribute(name).Value == null)
         return defaultValue;
       return element.Attribute(name).Value;
     }
  }
}</pre></p>
<p><strong>Extensions 3 and 4: GetElementFromPath and GetValueFrompath</strong></p>
<p>These extensions are more exotic. They allow me to ask for an element or a value down a path from the current element, returning a default value if the element or value is not present:</p>
<p><pre class="brush: csharp;">public static XElement GetElementFromPath(this XElement element, params string[] path)
{
  if (element == null)
    return null;

  XElement current = element;
  foreach (string s in path)
  {
    if (current != null &amp;&amp; current.Element(s) != null)
      current = current.Element(s);
  }
  return current;
}

public static string GetValueFromPath(this XElement element, params string[] path)
{
  if (element == null)
    return string.Empty;

  XElement current = element;
  foreach (string s in path)
  {
    if (current != null &amp;&amp; current.Element(s) != null)
      current = current.Element(s);
  }
  return current != null ? current.Value : &quot;&quot;;
}</pre></p>
<p>The functions might seem strange, but it&#8217;s cool to be able to do this:</p>
<p><pre class="brush: csharp;">element.GetValueFromPath(&quot;employee&quot;, &quot;position&quot;);</pre></p>
<p><strong>Extension 5: Convert XElement to XmlElement</strong></p>
<p>The last extension method is a old goodie. Converting from the <a href="http://msdn.microsoft.com/en-us/library/bb308959.aspx" target="_blank">LINQ</a> based XElement to the old-fashioned <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlelement.aspx" target="_blank">XmlElement</a> class is handy when working with web services or other methods that requires the old XmlElement.</p>
<p><pre class="brush: csharp;">    public static XmlElement ToXmlElement(this XElement element)
    {
      return new XmlService(element).CreateXmlElement();
    }

    #region internal conversion class

    internal class XmlService
    {
      private readonly StringBuilder _sb;
      private readonly XmlWriter _writer;

      private XmlService()
      {
        _sb = new StringBuilder();
        _writer = new XmlTextWriter(new StringWriter(_sb))
        {
          Formatting = Formatting.Indented,
          Indentation = 2
        };
      }

      public XmlService(XNode e) : this()
      {
        e.WriteTo(_writer);
      }

      public XmlService(XmlNode e) : this()
      {
        e.WriteTo(_writer);
      }

      public XElement CreateXElement()
      {
        return XElement.Load(new StringReader(_sb.ToString()));
      }

      public XDocument CreateXDocument()
      {
        return XDocument.Load(new StringReader(_sb.ToString()));
      }

      public XmlElement CreateXmlElement()
      {
        return CreateXmlDocument().DocumentElement;
      }

      public XmlDocument CreateXmlDocument()
      {
        var doc = new XmlDocument();
        doc.Load(new XmlTextReader(new StringReader(_sb.ToString())));
        return doc;
      }
    }
    #endregion
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/919/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=919&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2012/01/09/xelement-get-default-values-using-extension-methods/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>
	</item>
		<item>
		<title>Is Sitecore security slowing you down?</title>
		<link>http://briancaos.wordpress.com/2011/12/21/is-sitecore-security-slowing-you-down/</link>
		<comments>http://briancaos.wordpress.com/2011/12/21/is-sitecore-security-slowing-you-down/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 11:41:10 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[Sitecore 6]]></category>
		<category><![CDATA[CheckSecurityOnLanguages]]></category>
		<category><![CDATA[CheckSecurityOnTreeNodes]]></category>
		<category><![CDATA[Fast Query]]></category>
		<category><![CDATA[Optimising]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ShowNumberOfLockedItemsOnButton]]></category>
		<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[Slow]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=910</guid>
		<description><![CDATA[Recently, several blogs have posted about hidden settings that allows you to disable certain security related features in Sitecore. Sitecore can contain many users or many groups. This will sometimes lead to slow performance in the Sitecore shell or in the Sitecore page editor. One of the reasons that Sitecore becomes slow, is that some security-releated lookups [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=910&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently, several blogs have posted about hidden settings that allows you to disable certain security related features in <a href="http://www.sitecore.net" target="_blank">Sitecore</a>. Sitecore can contain many users or many groups. This will sometimes lead to slow performance in the Sitecore shell or in the Sitecore page editor.</p>
<p>One of the reasons that Sitecore becomes slow, is that some security-releated lookups is done using the <a href="http://briancaos.wordpress.com/2010/10/11/sitecore-fast-query/" target="_blank">Sitecore Fast Query</a>. Fast queries are not always fast, as these queries are non-cached SQL select statements done directly on the database:</p>
<p><pre class="brush: csharp;">Database.SelectItems(&quot;fast://*[@__lock='%\&quot;&quot; + Context.User.Name + &quot;\&quot;%']&quot;);</pre></p>
<p>Some of the lookups are done merely to enhance the user experience &#8211; not to enforce security schemes. So some of the lookups can be disabled using <strong>web.config</strong> settings. Here are a few of them:</p>
<p><strong>CheckSecurityOnLanguages</strong></p>
<p>This settings enforces security on languages. The settings is TRUE per default and allows you to allow/disallow access to languages. <a href="http://briancaos.wordpress.com/2010/06/30/setting-up-security-on-languages-in-sitecore-6/" target="_blank">Read this article on how to set up security on languages</a>.</p>
<p>The check is used by <strong>Sitecore.Globalization.GetLanguages(),</strong> Sitecore.Security.AccessControl.ItemAccess.<strong>CanReadLanguage()</strong> and Sitecore.Security.AccessControl.ItemAccess.<strong>CanWriteLanguage()</strong>, and it is also  used by the GetContentEditorWarnings.<strong>CanReadLanguage</strong> processor.</p>
<p>If your website is not a multilanguage site, or you allow all editors to access all languages, you can disable this check.</p>
<p><strong>ContentEditor.CheckSecurityOnTreeNodes</strong></p>
<p>This settings is also TRUE by default and it will read the security settings on each node to ensure that you have read acces. If not, the node is hidden. If FALSE, every node is displayed in the tree view, and security is enforced when clicking the node. If you don&#8217;t care that every editor can see every node in the tree, you may disable this. Security is still enforced when the editor clicks an item.</p>
<p><strong>WebEdit.ShowNumberOfLockedItemsOnButton</strong></p>
<p>This settings applies to the page editor, especially the &#8220;My Items&#8221; button, which will display how many items you have locked. This lookup is done using Sitecore Fast Query, and can be painfully slow when having lots of users and groups.</p>
<p><a href="http://sitecoreblog.alexshyba.com/2011/11/hidden-gem-of-sitecore-page-editor.html" target="_blank">Read more about the ShowNumberOfLockedItemsOnButton feature here</a>.</p>
<p><strong>Other resources:</strong></p>
<p>If you are interested in Sitecore performance tweaking, these blogs are worth a visit:</p>
<ul>
<li>Read Alex Shybas <a href="http://sitecoreblog.alexshyba.com/2010/09/optimize-sitecore-performance-checklist.html" target="_blank">Sitecore Performance Checklist</a>.</li>
<li><a href="http://sdn.sitecore.net/Articles/Administration/Sitecore%20Performance/Optimizing%20Sitecore%206%20and%20later/Optimizing%20Performance%20in%20Sitecore.aspx" target="_blank">Optimizing Performance In Sitecore</a> by Sitecore themselves (requires login).</li>
<li><a href="http://blog.navigationarts.com/sitecore-performance-analysis-profiling-debugging-caching-more/" target="_blank">Sitecore Performance Analysis</a> by navigation arts.</li>
<li><a href="http://theclientview.net/" target="_blank">The Client View</a> by Dan Brown is also a good resource, especially his <a href="http://theclientview.net/2011/02/setting-database-properties-to-improve-performance/" target="_blank">article on database properties</a> and the article about <a href="http://theclientview.net/2011/03/set-iis-expire-web-content-header-to-improve-performance/" target="_blank">IIS Expire Web Content</a> caught my attention.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/910/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=910&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2011/12/21/is-sitecore-security-slowing-you-down/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Sitecore EditFrame in PageEdit</title>
		<link>http://briancaos.wordpress.com/2011/11/28/using-sitecore-editframe-in-pageedit/</link>
		<comments>http://briancaos.wordpress.com/2011/11/28/using-sitecore-editframe-in-pageedit/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 13:03:58 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[General .NET]]></category>
		<category><![CDATA[Sitecore 6]]></category>
		<category><![CDATA[Content Editing]]></category>
		<category><![CDATA[EditFrame]]></category>
		<category><![CDATA[IsPageEditor]]></category>
		<category><![CDATA[Page Edit]]></category>
		<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[TreeList]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=899</guid>
		<description><![CDATA[The sc:EditFrame is a Sitecore Page Editor (called Content Editing in Sitecore marketing terminology) feature that allows front end access to fields that are not directly accessible, either because they are not visible or they are of a type that are not directly front end editable. Basically, Text, Rich Text, Image, Link  and fields like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=899&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <strong>sc:EditFrame</strong> is a <a href="http://www.sitecore.net" target="_blank">Sitecore</a> Page Editor (called <a href="http://www.sitecore.net/Products/Web-Content-Management/Content-Management/Content-Editing.aspx" target="_blank">Content Editin</a>g in Sitecore marketing terminology) feature that allows front end access to fields that are not directly accessible, either because they are not visible or they are of a type that are not directly front end editable.</p>
<p>Basically, Text, Rich Text, Image, Link  and fields like that are directly editable. But MultiList fields, checkbox fields and other types are not. This is where the EditFrame comes in.</p>
<p>This is a list of links placed on my website:</p>
<div id="attachment_904" class="wp-caption aligncenter" style="width: 311px"><a href="http://briancaos.files.wordpress.com/2011/11/list-of-links.jpg"><img class="size-full wp-image-904" title="List of Links" src="http://briancaos.files.wordpress.com/2011/11/list-of-links.jpg?w=780" alt="List of Links"   /></a><p class="wp-caption-text">List of Links</p></div>
<p>The list of links is a TreeList field:</p>
<div id="attachment_903" class="wp-caption aligncenter" style="width: 673px"><a href="http://briancaos.files.wordpress.com/2011/11/treelist-field.jpg"><img class="size-full wp-image-903" title="TreeList Field" src="http://briancaos.files.wordpress.com/2011/11/treelist-field.jpg?w=780" alt="TreeList Field"   /></a><p class="wp-caption-text">TreeList Field</p></div>
<p>I would like to give the user acces to edit this field from the Page Editor. But using the sc:FieldRenderer only allows the user to edit any field that the treelist points to. So to give access to the TreeList field itself, I need to do the following:</p>
<p>First, I need to create a new <strong>Edit Frame Button</strong> in the core database.</p>
<p>Go to <strong>/sitecore/content/Applications/WebEdit/Edit Frame Buttons</strong> and create a new <strong>Edit Frame Button Folder</strong>. In this folder, create a new <strong>Edit Frame Button</strong>. In the field &#8220;<strong>Fields</strong>&#8221; you type in te names of the fields that this button should give edit acces to:</p>
<div id="attachment_900" class="wp-caption aligncenter" style="width: 560px"><a href="http://briancaos.files.wordpress.com/2011/11/editframe-buttons.jpg"><img class="size-medium wp-image-900" title="EditFrame Buttons" src="http://briancaos.files.wordpress.com/2011/11/editframe-buttons.jpg?w=550" alt="EditFrame Buttons" width="550" /></a><p class="wp-caption-text">EditFrame Buttons</p></div>
<p>Next step is to modify the <a href="http://www.asp101.com/lessons/usercontrols.asp" target="_blank">user control</a> that renders my list of links:</p>
<p>In the rendering that renders the list of links, I must add an <strong>EditFrame</strong> surrounding my list:</p>
<p><pre class="brush: csharp;">&lt;sc:EditFrame id=&quot;editLinks&quot; runat=&quot;server&quot; Buttons=&quot;/sitecore/content/Applications/WebEdit/Edit Frame Buttons/DocumentLinks&quot;&gt;

  // Inside this edit frame is the HTML that renders the list of links.
  &lt;h2&gt;
    Links
  &lt;/h2&gt;
  &lt;asp:ListView ID=&quot;lvLinks&quot; runat=&quot;server&quot; DataSource=&quot;&lt;%# Links %&gt;&quot; EnableViewState=&quot;false&quot;&gt;
    &lt;LayoutTemplate&gt;
      &lt;ul class=&quot;LinkList&quot;&gt;
        &lt;asp:PlaceHolder runat=&quot;server&quot; ID=&quot;itemPlaceholder&quot; /&gt;
      &lt;/ul&gt;
      &lt;/LayoutTemplate&gt;
        &lt;ItemTemplate&gt;
          &lt;li&gt;&lt;a href=&quot;&lt;%# Sitecore.Links.LinkManager.GetItemUrl(Container.DataItem as Sitecore.Data.Items.Item) %&gt;&quot;&gt;
            &lt;sc:FieldRenderer ID=&quot;frItemTitle&quot; FieldName=&quot;NavigationTitle&quot; runat=&quot;server&quot; Item=&quot;&lt;%# Container.DataItem as Sitecore.Data.Items.Item %&gt;&quot; /&gt;
          &lt;/a&gt;&lt;/li&gt;
        &lt;/ItemTemplate&gt;
      &lt;/asp:ListView&gt;
  &lt;/asp:Panel&gt;

&lt;/sc:EditFrame&gt;</pre></p>
<p>The EditFrame has an attribute called &#8220;<strong>Buttons</strong>&#8221; that points to the EditFrame Buttons Folder that I created earlier.</p>
<p>The code is now finished.</p>
<p>When the user hover above the Links in Page Edit mode, he will see the edit frame with the &#8220;Edit&#8221; button:</p>
<div id="attachment_901" class="wp-caption aligncenter" style="width: 296px"><a href="http://briancaos.files.wordpress.com/2011/11/editframe.jpg"><img class="size-full wp-image-901" title="EditFrame" src="http://briancaos.files.wordpress.com/2011/11/editframe.jpg?w=780" alt="EditFrame"   /></a><p class="wp-caption-text">EditFrame</p></div>
<pre>And clicking the button will open the TreeList field in a seperate window:</pre>
<div id="attachment_902" class="wp-caption aligncenter" style="width: 560px"><a href="http://briancaos.files.wordpress.com/2011/11/open-editframe-for-editing.jpg"><img class="size-medium wp-image-902" title="Open EditFrame For Editing" src="http://briancaos.files.wordpress.com/2011/11/open-editframe-for-editing.jpg?w=550" alt="Open EditFrame For Editing" width="550" /></a><p class="wp-caption-text">Open EditFrame For Editing</p></div>
<p><strong>Please Note:</strong></p>
<p>In Sitecore 6.5 (maybe also other versions of Sitecore) you need to save the page before the selected fields becomes visible. It is not enough to press the &#8220;OK&#8221; button in the dialog window.</p>
<p><strong>Other usages</strong></p>
<p>You can also use the EditFrame for fields that are only visible if they are not empty, and for fields that are not visible at all. You can use the <a href="http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2010/10/How-Does-Sitecore-6-4-Affect-PageMode.aspx" target="_blank">Sitecore.Context.PageMode.IsPageEditor</a> attribute to determine if the current page is in the Page Edit mode, and when so, display a text inside the edit frame:</p>
<p><pre class="brush: csharp;">&lt;sc:EditFrame id=&quot;editLinks&quot; runat=&quot;server&quot; Buttons=&quot;/sitecore/content/Applications/WebEdit/Edit Frame Buttons/DocumentLinks&quot;&gt;
  &lt;asp:Panel ID=&quot;panNoLinksAndPageEditing&quot; Visible=&quot;&lt;%# Sitecore.Context.PageMode.IsPageEditor %&gt;&quot; runat=&quot;server&quot;&gt;
    Edit Links
  &lt;/asp:Panel&gt;
&lt;/sc:EditFrame&gt;</pre></p>
<p>The original code with the links list actually uses the same technique, as the list is hidden if there is no links selected. In this scenario, I add a panel that is only visible if the list is empty and the page is in editing mode:</p>
<p><pre class="brush: csharp;">&lt;sc:EditFrame id=&quot;editLinks&quot; runat=&quot;server&quot; Buttons=&quot;/sitecore/content/Applications/WebEdit/Edit Frame Buttons/DocumentLinks&quot;&gt;
  &lt;asp:Panel ID=&quot;panNoLinksAndPageEditing&quot; Visible=&quot;&lt;%# !HasLinks &amp;&amp; Sitecore.Context.PageMode.IsPageEditor  %&gt;&quot; runat=&quot;server&quot; CssClass=&quot;Spot SpotLinks&quot;&gt;
    &lt;dictionary:literal runat=&quot;server&quot; path=&quot;/Document/Links&quot; defaulttext=&quot;Links&quot; /&gt;
  &lt;/asp:Panel&gt;
  &lt;asp:Panel ID=&quot;panLinks&quot; Visible=&quot;&lt;%# HasLinks %&gt;&quot; runat=&quot;server&quot; CssClass=&quot;Spot SpotLinks&quot;&gt;
    &lt;h2&gt;
      &lt;dictionary:literal runat=&quot;server&quot; path=&quot;/Document/Links&quot; defaulttext=&quot;Links&quot; /&gt;
    &lt;/h2&gt;
      &lt;asp:ListView ID=&quot;lvLinks&quot; runat=&quot;server&quot; DataSource=&quot;&lt;%# Links %&gt;&quot; EnableViewState=&quot;false&quot;&gt;
        &lt;LayoutTemplate&gt;
          &lt;ul class=&quot;LinkList&quot;&gt;
            &lt;asp:PlaceHolder runat=&quot;server&quot; ID=&quot;itemPlaceholder&quot; /&gt;
          &lt;/ul&gt;
        &lt;/LayoutTemplate&gt;
        &lt;ItemTemplate&gt;
          &lt;li&gt;&lt;a href=&quot;&lt;%# Sitecore.Links.LinkManager.GetItemUrl(Container.DataItem as Sitecore.Data.Items.Item) %&gt;&quot;&gt;
            &lt;sc:FieldRenderer ID=&quot;frItemTitle&quot; FieldName=&quot;NavigationTitle&quot; runat=&quot;server&quot; Item=&quot;&lt;%# Container.DataItem as Sitecore.Data.Items.Item %&gt;&quot; /&gt;
          &lt;/a&gt;&lt;/li&gt;
        &lt;/ItemTemplate&gt;
      &lt;/asp:ListView&gt;
  &lt;/asp:Panel&gt;
&lt;/sc:EditFrame&gt;</pre></p>
<p>The EditFrame is also your shourtcut to upgrade websites that are not Page Editable from the beginning. Although I would recommend that you rewrite your website using the <a href="http://briancaos.wordpress.com/2011/01/25/using-usercontrols-instead-of-xslt-in-sitecore-projects/" target="_blank">sc:FieldRenderer</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/899/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=899&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2011/11/28/using-sitecore-editframe-in-pageedit/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>

		<media:content url="http://briancaos.files.wordpress.com/2011/11/list-of-links.jpg" medium="image">
			<media:title type="html">List of Links</media:title>
		</media:content>

		<media:content url="http://briancaos.files.wordpress.com/2011/11/treelist-field.jpg" medium="image">
			<media:title type="html">TreeList Field</media:title>
		</media:content>

		<media:content url="http://briancaos.files.wordpress.com/2011/11/editframe-buttons.jpg?w=550" medium="image">
			<media:title type="html">EditFrame Buttons</media:title>
		</media:content>

		<media:content url="http://briancaos.files.wordpress.com/2011/11/editframe.jpg" medium="image">
			<media:title type="html">EditFrame</media:title>
		</media:content>

		<media:content url="http://briancaos.files.wordpress.com/2011/11/open-editframe-for-editing.jpg?w=550" medium="image">
			<media:title type="html">Open EditFrame For Editing</media:title>
		</media:content>
	</item>
		<item>
		<title>Parse namevalue collection with quotation marks handling</title>
		<link>http://briancaos.wordpress.com/2011/11/22/parse-namevalue-collection-with-quotation-marks-handling/</link>
		<comments>http://briancaos.wordpress.com/2011/11/22/parse-namevalue-collection-with-quotation-marks-handling/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 12:21:48 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[General .NET]]></category>
		<category><![CDATA[Collection]]></category>
		<category><![CDATA[Dictionary]]></category>
		<category><![CDATA[NameValue]]></category>
		<category><![CDATA[Parse]]></category>
		<category><![CDATA[Quotation marks]]></category>
		<category><![CDATA[Quotes]]></category>
		<category><![CDATA[Split]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=885</guid>
		<description><![CDATA[Parsing of namevalue collections is a common pattern. .NET have build in parsing of Query Strings, and other bloggers have solutions on how to do this. This is Yet Another NameValueCollection parser. It will parse not only query strings, but also other collections. This query string can be parsed: id=2&#38;title=hello&#38;subtitle=world id = 2 title = hello [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=885&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Parsing of namevalue collections is a common pattern. .NET have build in parsing of <a href="http://stackoverflow.com/questions/68624/how-to-parse-a-query-string-into-a-namevaluecollection-in-net" target="_blank">Query Strings</a>, and other bloggers have <a href="http://stackoverflow.com/questions/390286/generic-parse-method-without-boxing" target="_blank">solutions on how to do this</a>.</p>
<p>This is Yet Another NameValueCollection parser. It will parse not only query strings, but also other collections. This query string can be parsed:</p>
<ul>
<li>id=<strong>2</strong>&amp;title=<strong>hello</strong>&amp;subtitle=<strong>world</strong></li>
<ul>
<li>id = 2</li>
<li>title = hello</li>
<li>subtitle = world</li>
</ul>
</ul>
<p>But also more complex strings, where your seperators are inside quotation marks can be parsed. For example:</p>
<ul>
<li>id=<strong>2</strong>|title=&#8217;<strong>hello=world</strong>&#8216;|subtitle=&#8217;<strong>sub|title</strong>&#8216;</li>
<ul>
<li>id = 2</li>
<li>title = hello=world</li>
<li>subtitle = sub|title</li>
</ul>
</ul>
<p>Ignoring seperators inside quotes (&#8221; and &#8220;&#8221;) requires more complex code than just calling the <a href="http://msdn.microsoft.com/en-us/library/system.string.split.aspx" target="_blank">Split()</a> function on a string, but the code is not that complex.<br />
This class parses any name/value collection string, ignoring seperators inside quotes (&#8221; and &#8220;&#8221;):</p>
<p><pre class="brush: csharp;">using System;
using System.Collections;
using System.Collections.Generic;

namespace PT.MyCode
{
  internal class NameValueCollectionParser
  {
    public NameValueCollectionParser(char innerSeperator, char outerSeperator)
    {
      InnerSeperator = innerSeperator;
      OuterSeperator = outerSeperator;
    }

    public char InnerSeperator { get; private set; }
    public char OuterSeperator { get; private set; }

    public void GetNameValueSet(string nameValueColection, ref Dictionary&lt;string, string&gt; output)
    {
      foreach (string nameValueSet in Split(nameValueColection, OuterSeperator))
      {
        string[] nameValueSetSplitted = Split(nameValueSet, InnerSeperator);
        if (nameValueSetSplitted.Length != 2)
          return;
        output.Add(nameValueSetSplitted[0], nameValueSetSplitted[1]);
      }
    }

    private string[] Split(string values, char seperator)
    {
      var list = new ArrayList();
      bool insidePlings = false;
      int ac = 0;
      int begin = 0;
      CharEnumerator en = values.GetEnumerator();
      while (en.MoveNext())
      {
        if (en.Current == '\'' || en.Current == '\&quot;')
        {
          if (insidePlings)
            insidePlings = false;
          else
            insidePlings = true;
        }
        else if (en.Current == seperator &amp;&amp; !insidePlings)
        {
          string s = Trim(values.Substring(begin, ac - begin));
          list.Add(s);
          begin = ac + 1;
        }
        ac++;
      }
      list.Add(Trim(values.Substring(begin, values.Length - begin)));

      return list.ToArray(typeof (string)) as string[];
    }

    private string Trim(string s)
    {
      s = s.TrimStart(',');
      s = s.TrimStart('\'', '\&quot;');
      s = s.TrimEnd('\'', '\&quot;');
      s = s.Trim();
      return s;
    }
  }
}</pre></p>
<p>The class is prepared to be used in an <a href="http://csharp.net-tutorials.com/csharp-3.0/extension-methods/" target="_blank">Extension method</a> on the <a href="http://www.c-sharpcorner.com/uploadfile/mahesh/dictionary-in-C-Sharp/" target="_blank">Dictionary</a> class:</p>
<p><pre class="brush: csharp;">using System.Collections.Generic;

namespace PT.MyCode
{
  internal static class DictionaryExtension
  {
    public static void AddNameValueCollection(this Dictionary&lt;string, string&gt; dictionary, char outerSeperator, char innerSeperator, string value)
    {
      NameValueCollectionParser parser = new NameValueCollectionParser(innerSeperator, outerSeperator);
      parser.GetNameValueSet(value, ref dictionary);
    }

  }
}</pre></p>
<p>The extension method is now ready to be used:</p>
<p><pre class="brush: csharp;">Dictionary&lt;string, string&gt; attributes = new Dictionary&lt;string, string&gt;();
attributes.AddNameValueCollection('|', '=', &quot;id=2|title=\&quot;hello=world\&quot;|text=\&quot;tell me how|you are doing\&quot;&quot;);</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/885/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/885/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/885/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=885&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2011/11/22/parse-namevalue-collection-with-quotation-marks-handling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>
	</item>
		<item>
		<title>Get last visited pages from a Sitecore DMS (OMS) Profile</title>
		<link>http://briancaos.wordpress.com/2011/11/18/get-last-visited-pages-from-a-sitecore-dms-oms-profile/</link>
		<comments>http://briancaos.wordpress.com/2011/11/18/get-last-visited-pages-from-a-sitecore-dms-oms-profile/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 12:33:03 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Sitecore 6]]></category>
		<category><![CDATA[Analytics]]></category>
		<category><![CDATA[DMS]]></category>
		<category><![CDATA[OMS]]></category>
		<category><![CDATA[Profile]]></category>
		<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[Tracker]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=880</guid>
		<description><![CDATA[Quite a few Sitecore developers have wondered how to get any useful information out of the Sitecore DMS (Digital Marketing System), formerly known as Sitecore OMS (Online Marketing Suite). I&#8217;ll call it the Sitecore Analytics, since the namespace is Sitecore.Analytics. The API for Sitecore DMS is &#8211; how should I put it &#8211; not of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=880&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quite a few <a href="http://www.sitecore.net" target="_blank">Sitecore</a> developers have wondered how to get any useful information out of the Sitecore DMS (<a href="http://www.sitecore.net/Products/Digital-Marketing-System.aspx" target="_blank">Digital Marketing System</a>), formerly known as Sitecore OMS (Online Marketing Suite). I&#8217;ll call it the Sitecore Analytics, since the namespace is <strong>Sitecore.Analytics</strong>. The API for Sitecore DMS is &#8211; how should I put it &#8211; not of the same high quality standard as Sitecore itself. However, this has never stopped anyone, and since DMS is packed with visitor data, I&#8217;ll show how to utilize this.</p>
<p>This is a simple example on how to use the DMS. This function extracts the full history of which pages the current visitor have clicked:</p>
<p><pre class="brush: csharp;">IEnumerable allVisitedPages = Sitecore.Analytics.Tracker.Visitor.DataContext.Pages.Reverse();
</pre></p>
<p>This is the full history. I reverse the list to get the last visited pages at the top. If the user has visited a page twice, it will show up twice. And any page is in the list, also the web site frontpage.</p>
<p>So the list needs to be filtered somehow. This example creates a fictional list of the 10 last product pages the user has visited:</p>
<p><pre class="brush: csharp;">protected IEnumerable GetProducts(int count)
{
  IEnumerable allVisitedPages = Sitecore.Analytics.Tracker.Visitor.DataContext.Pages.Reverse();

  List lastVisitedProducts = new List();
  int ac = 0;
  IEnumerable products = allVisitedPages.Select(GetItem).Where(item =&gt; item != null &amp;&amp; item.TemplateName == &quot;product&quot; );
  foreach (Item product in products)
  {
    if (!lastVisitedProducts.Exists(p =&gt; p.ID == product.ID))
    {
      lastVisitedProducts.Add(product);
      ac++;
    }
    if (ac == count)
      return lastVisitedProducts;
  }
  return lastVisitedProducts;
}</pre></p>
<p>The real gem here is that the user profile is stored in a cookie, so the data is persisted. The next time the user opens the website, the data is still there and you can display the last visited products list.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/880/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/880/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/880/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/880/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/880/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/880/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/880/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/880/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/880/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/880/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/880/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/880/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/880/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/880/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=880&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2011/11/18/get-last-visited-pages-from-a-sitecore-dms-oms-profile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the Sitecore Audit Log</title>
		<link>http://briancaos.wordpress.com/2011/11/02/using-the-sitecore-audit-log/</link>
		<comments>http://briancaos.wordpress.com/2011/11/02/using-the-sitecore-audit-log/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 13:11:04 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[Sitecore 6]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[AuditFormatter]]></category>
		<category><![CDATA[Log]]></category>
		<category><![CDATA[Log4Net]]></category>
		<category><![CDATA[Sitecore]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=873</guid>
		<description><![CDATA[I guess your code contains just as many log messages as my code does: And the exception is written to the log: In previous versions, the Audit log was a seperate log. But now it&#8217;s all handled by Apache Log4Net. So writing to the audit log is similar to writing to the log. The following line: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=873&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I guess your code contains just as many log messages as my code does:</p>
<p><pre class="brush: csharp;">try
{
  // lots of stuff going on here...
}
catch (Exception ex)
{
  Sitecore.Diagnostics.Log.Error(&quot;Some great error message: &quot; + ex.Message, this);
  // more exception handling here...
}</pre></p>
<p>And the exception is written to the log:</p>
<p><pre class="brush: plain;">6636 13:35:42 ERROR Some great error message: blahblahblah</pre></p>
<p>In previous versions, the Audit log was a seperate log. But now it&#8217;s all handled by <a href="http://logging.apache.org/log4net/" target="_blank">Apache Log4Net</a>. So writing to the audit log is similar to writing to the log. The following line:</p>
<p><pre class="brush: csharp;">Sitecore.Diagnostics.Log.Audit(&quot;DamForSitecore:RemoveAssetFromCache. AssetID=&quot; + assetID, this);</pre></p>
<p>Produces the following log line:</p>
<p><pre class="brush: plain;">3360 13:56:27 INFO  AUDIT (sitecore\admin): DamForSitecore:RemoveAssetFromCache. AssetID=4848</pre></p>
<p>You can use the AuditFormatter to format items and fields so they appear with the same pattern for all items and fields in the log.<br />
The following line:</p>
<p><pre class="brush: csharp;">Sitecore.Diagnostics.Log.Audit(this, &quot;Do stuff {0}&quot;, new[] {AuditFormatter.FormatItem(Sitecore.Context.Item)});</pre></p>
<p>Produces the following log line:</p>
<p><pre class="brush: plain;">3360 14:06:18 INFO  AUDIT (sitecore\admin): Do stuff: master:/sitecore/content/Home, language: da, version: 2, id: {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}</pre></p>
<p>Other articles regarding the subject:</p>
<ul>
<li><a href="http://sdn.sitecore.net/scrapbook/how%20to%20make%20sitecore%206%20write%20audit%20log%20to%20its%20own%20file.aspx" target="_blank">Write audit logs to a seperate file</a></li>
<li><a href="http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/All-About-Logging-with-the-Sitecore-ASPNET-CMS.aspx" target="_blank">All about logging</a></li>
<li><a href="http://sitecoreblog.alexshyba.com/2010/07/sitecore-logging-write-it-to-sql.html" target="_blank">Write log to a SQL database</a></li>
</ul>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/873/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/873/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/873/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/873/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/873/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/873/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/873/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/873/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/873/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/873/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/873/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/873/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/873/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/873/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=873&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2011/11/02/using-the-sitecore-audit-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>
	</item>
		<item>
		<title>Get items based on Metadata using Sitecore AdvancedDatabaseCrawler Lucene index</title>
		<link>http://briancaos.wordpress.com/2011/10/14/get-items-based-on-metadata-using-sitecore-advanceddatabasecrawler-lucene-index/</link>
		<comments>http://briancaos.wordpress.com/2011/10/14/get-items-based-on-metadata-using-sitecore-advanceddatabasecrawler-lucene-index/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 06:00:02 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[General .NET]]></category>
		<category><![CDATA[Sitecore 6]]></category>
		<category><![CDATA[AdvancedDatabaseCrawler]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[Lucene]]></category>
		<category><![CDATA[Metadata]]></category>
		<category><![CDATA[Multilist]]></category>
		<category><![CDATA[Sitecore]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=861</guid>
		<description><![CDATA[This is the 3rd and last in the series on using the open source AdvancedDatabaseCrawler Lucene index. From Sitecore 6.5, Sitecore is deprecating the old Lucene index. This means that we have to redo our index work. Fortunately, Alex Shyba has created an open source module that makes indexing and retrieving easy. This is article 3 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=861&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is the 3rd and last in the series on using the open source <a href="http://trac.sitecore.net/AdvancedDatabaseCrawler/browser/Branches/v2/" target="_blank">AdvancedDatabaseCrawler</a> Lucene index. From Sitecore 6.5, Sitecore is deprecating the old Lucene index. This means that we have to redo our index work. Fortunately, <a href="http://sitecoreblog.alexshyba.com/" target="_blank">Alex Shyba</a> has created an open source module that makes indexing and retrieving easy.</p>
<p>This is article 3 of 3 articles:</p>
<p><a href="http://briancaos.wordpress.com/2011/10/12/using-the-sitecore-open-source-advanceddatabasecrawler-lucene-indexer/" target="_blank">Part 1 – Configuring the index: Using the Sitecore open source AdvancedDatabaseCrawler Lucene indexer</a><br />
<a href="http://briancaos.wordpress.com/2011/10/13/get-latest-news-using-sitecore-advanceddatabasecrawler-lucene-index/" target="_blank">Part 2 – Simple search: Get latest news using Sitecore AdvancedDatabaseCrawler Lucene index</a><br />
<a href="http://briancaos.wordpress.com/2011/10/14/get-items-based-on-metadata-using-sitecore-advanceddatabasecrawler-lucene-index/" target="_blank">Part 3 – Multivalue search: Get items based on Metadata using Sitecore AdvancedDatabaseCrawler Lucene index</a></p>
<p>If you have not read the first article, you should read it, as it explains how to compile the module and how to set up an index that indexes your WEB database.</p>
<p>This is the second-most common Lucene index task: How to get a list of items scattered all over your website based on GUID values in a multilist field. For example, if you use metadata to tag pages, and you need to show a list of all pages with a certain set of metadata.</p>
<p>Here is my scenario: I have a list of metadata categories:</p>
<div id="attachment_862" class="wp-caption aligncenter" style="width: 326px"><a href="http://briancaos.files.wordpress.com/2011/10/metadatacategories.jpg"><img class="size-full wp-image-862" title="MetaDataCategories" src="http://briancaos.files.wordpress.com/2011/10/metadatacategories.jpg?w=780" alt="A list of Metadata Categories"   /></a><p class="wp-caption-text">Metadata Categories</p></div>
<p>These metadata are applied to my pages through the <strong>Categories</strong> field multiselect box:</p>
<div id="attachment_863" class="wp-caption aligncenter" style="width: 510px"><a href="http://briancaos.files.wordpress.com/2011/10/metadataselected.jpg"><img class="size-medium wp-image-863" title="MetaDataSelected" src="http://briancaos.files.wordpress.com/2011/10/metadataselected.jpg?w=500" alt="Metadata applied to a page" width="500" /></a><p class="wp-caption-text">Metadata applied to a page</p></div>
<p>Any page can have 0-<em>n</em> categories. Now I would like to get all pages that have both &#8220;Childrens Books&#8221; and &#8220;Classical Literature&#8221; metdata.</p>
<p>My index is already set up so it indexes every field in my solution (<a href="http://briancaos.wordpress.com/2011/10/12/using-the-sitecore-open-source-advanceddatabasecrawler-lucene-indexer/" target="_blank">read about the configuration of the index here</a>), so I only have to set up a search. And thanks to <a href="http://sitecoreblog.alexshyba.com/" target="_blank">Alex Shybas</a> AdvancedDatabaseCrawler, this is easy:</p>
<p><pre class="brush: csharp;">using System;
using System.Collections.Generic;
using System.Linq;
using Sitecore.Data.Items;
using Sitecore.SharedSource.Searcher;
using Sitecore.SharedSource.Searcher.Parameters;

namespace PT.Prototype.Search
{
  public partial class _default : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      DataBind();
    }

    public IEnumerable&lt;Item&gt; GetClassicalChildrensBooks()
    {
      // The Refinements are a list of field/value searches that must be performed.
      // My list is simple, as I search in the field &quot;categories&quot; for the GUID of
      // &quot;Childrens Books&quot; and &quot;Classical Literature&quot;
      List&lt;MultiFieldSearchParam.Refinement&gt; refinements = new List&lt;MultiFieldSearchParam.Refinement&gt;();
      refinements.Add(new MultiFieldSearchParam.Refinement(&quot;categories&quot;, &quot;{4481D164-CF7C-421B-BC98-6189AB754C65}&quot;));
      refinements.Add(new MultiFieldSearchParam.Refinement(&quot;categories&quot;, &quot;{C813518E-6880-4FBE-A10F-7F8CE51AA52D}&quot;));

      MultiFieldSearchParam searchParam = new MultiFieldSearchParam();

      // The name of the database to search in
      searchParam.Database = &quot;web&quot;;
      // The language to return
      searchParam.Language = &quot;en&quot;;
      // The AND/OR/NOT condition between fields
      searchParam.InnerCondition = Sitecore.Search.QueryOccurance.Must;
      // The fields to search in
      searchParam.Refinements = refinements;

      // Run the Query on the index called &quot;web&quot;
      QueryRunner runner = new QueryRunner(&quot;web&quot;);
      IEnumerable&lt;SkinnyItem&gt; items = runner.GetItems(searchParam);

      // Return the items found
      return items.Select(item =&gt; Sitecore.Context.Database.GetItem(item.ItemID));
    }
  }
}</pre></p>
<p>All I need to do now is to create an <a href="http://www.w3schools.com/aspnet/aspnet_repeater.asp" target="_blank">asp:Repeater</a> and databind it to the function:</p>
<p><pre class="brush: csharp;">&lt;%@ Register TagPrefix=&quot;sc&quot; Namespace=&quot;Sitecore.Web.UI.WebControls&quot; Assembly=&quot;Sitecore.Kernel&quot; %&gt;

&lt;asp:Repeater ID=&quot;repClassicalChildrensBooks&quot; DataSource=&quot;&lt;%# GetClassicalChildrensBooks() %&gt;&quot; runat=&quot;server&quot;&gt;
  &lt;HeaderTemplate&gt;
    &lt;ul&gt;
  &lt;/HeaderTemplate&gt;
  &lt;FooterTemplate&gt;
    &lt;/ul&gt;
  &lt;/FooterTemplate&gt;
  &lt;ItemTemplate&gt;
    &lt;li&gt;
      &lt;a href=&quot;&lt;%# Sitecore.Links.LinkManager.GetItemUrl(Container.DataItem as Sitecore.Data.Items.Item) %&gt;&quot;&gt;
        &lt;sc:FieldRenderer ID=&quot;FieldRenderer2&quot; FieldName=&quot;Title&quot; runat=&quot;server&quot; Item=&quot;&lt;%# Container.DataItem as Sitecore.Data.Items.Item %&gt;&quot; /&gt;
      &lt;/a&gt;
    &lt;/li&gt;
  &lt;/ItemTemplate&gt;
&lt;/asp:Repeater&gt;</pre></p>
<p>If I modify the <strong>searchParam.InnerCondition</strong> to <strong>Sitecore.Search.QueryOccurance.Should</strong>, I get an &#8220;OR&#8221; clause, returning all items with that is tagged with either &#8220;Childrens Books&#8221; or &#8220;Classical Literature&#8221; (or both).<br />
If modified to <strong>Sitecore.Search.QueryOccurance.MustNot</strong> I get a &#8220;NOT&#8221; clause, returning any item not tagged with the 2 categories.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/861/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=861&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2011/10/14/get-items-based-on-metadata-using-sitecore-advanceddatabasecrawler-lucene-index/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>

		<media:content url="http://briancaos.files.wordpress.com/2011/10/metadatacategories.jpg" medium="image">
			<media:title type="html">MetaDataCategories</media:title>
		</media:content>

		<media:content url="http://briancaos.files.wordpress.com/2011/10/metadataselected.jpg?w=500" medium="image">
			<media:title type="html">MetaDataSelected</media:title>
		</media:content>
	</item>
		<item>
		<title>Get latest news using Sitecore AdvancedDatabaseCrawler Lucene index</title>
		<link>http://briancaos.wordpress.com/2011/10/13/get-latest-news-using-sitecore-advanceddatabasecrawler-lucene-index/</link>
		<comments>http://briancaos.wordpress.com/2011/10/13/get-latest-news-using-sitecore-advanceddatabasecrawler-lucene-index/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 07:25:18 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[Sitecore 6]]></category>
		<category><![CDATA[AdvancedDatabaseCrawler]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[Lucene]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Sitecore]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=849</guid>
		<description><![CDATA[This is the first of 2 follow-up posts on how to use the Advanced Database Crawler open source module for Sitecore. From Sitecore 6.5, Sitecore is deprecating the old Lucene index. This means that we have to redo our index work. Fortunately, Alex Shyba has created an open source module that makes indexing and retrieving [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=849&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is the first of 2 follow-up posts on how to use the <a href="http://trac.sitecore.net/AdvancedDatabaseCrawler/browser/Branches/v2/" target="_blank">Advanced Database Crawler</a> open source module for Sitecore. From Sitecore 6.5, Sitecore is deprecating the old Lucene index. This means that we have to redo our index work. Fortunately, <a href="http://sitecoreblog.alexshyba.com/" target="_blank">Alex Shyba</a> has created an open source module that makes indexing and retrieving easy.</p>
<p>This is article 2 of 3 articles:</p>
<p><a href="http://briancaos.wordpress.com/2011/10/12/using-the-sitecore-open-source-advanceddatabasecrawler-lucene-indexer/" target="_blank">Part 1 – Configuring the index: Using the Sitecore open source AdvancedDatabaseCrawler Lucene indexer</a><br />
<a href="http://briancaos.wordpress.com/2011/10/13/get-latest-news-using-sitecore-advanceddatabasecrawler-lucene-index/" target="_blank">Part 2 – Simple search: Get latest news using Sitecore AdvancedDatabaseCrawler Lucene index</a><br />
<a href="http://briancaos.wordpress.com/2011/10/14/get-items-based-on-metadata-using-sitecore-advanceddatabasecrawler-lucene-index/" target="_blank">Part 3 – Multivalue search: Get items based on Metadata using Sitecore AdvancedDatabaseCrawler Lucene index</a></p>
<p>If you have not read the first article, you should read it, as it explains how to compile the module and how to set up an index that indexes your WEB database.</p>
<p>This example describes one of the most trivial tasks: How to retrieve a sorted list of items that is scattered over the entire website. For example, when you would like to list the latest news articles, it is fast and easy to use an index. <a href="http://perst.dk/" target="_blank">This website (Personalestyrelsen, a Danish web site)</a> uses this exact method to list the latest news on the front page.</p>
<p>This is the scenario: I have a news archive where all my news articles are stored:</p>
<div id="attachment_850" class="wp-caption aligncenter" style="width: 517px"><a href="http://briancaos.files.wordpress.com/2011/10/newsarchive.jpg"><img class="size-full wp-image-850" title="NewsArchive" src="http://briancaos.files.wordpress.com/2011/10/newsarchive.jpg?w=780" alt="An example of a news archive"   /></a><p class="wp-caption-text">An example of a news archive</p></div>
<p>Each news template contains a <strong>date</strong> field and a <strong>title</strong> field:</p>
<div id="attachment_851" class="wp-caption aligncenter" style="width: 510px"><a href="http://briancaos.files.wordpress.com/2011/10/newsarticle.jpg"><img class="size-medium wp-image-851" title="NewsArticle" src="http://briancaos.files.wordpress.com/2011/10/newsarticle.jpg?w=500" alt="Sample News Article" width="500" /></a><p class="wp-caption-text">Sample News Article</p></div>
<p>I would like to use the <strong>date</strong> field as my sort field, and then display the 3 latest news with the date and title.</p>
<p>My index is already set up so it indexes every field in my solution (<a href="http://briancaos.wordpress.com/2011/10/12/using-the-sitecore-open-source-advanceddatabasecrawler-lucene-indexer/" target="_blank">read about the configuration of the index here</a>) , so I only have to set up a search. And thanks to <a href="http://sitecoreblog.alexshyba.com/" target="_blank">Alex Shybas</a> AdvancedDatabaseCrawler, this is easy:</p>
<p><pre class="brush: csharp;">using System;
using System.Collections.Generic;
using System.Linq;
using Sitecore.Data.Items;
using Sitecore.SharedSource.Searcher;
using Sitecore.SharedSource.Searcher.Parameters;

namespace PT.Prototype.Search
{
  public partial class _default : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      DataBind();
    }

    public IEnumerable&lt;Item&gt; GetLatestNews(int numberOfNews)
    {
      SearchParam searchParam = new SearchParam();
      // The name of the database to search in
      searchParam.Database = &quot;web&quot;;
      // The language to return
      searchParam.Language = &quot;en&quot;;
      // The NewsItem template ID
      searchParam.TemplateIds = &quot;{2983E106-CE47-40B5-8704-D299CA9BFF8F}&quot;;
      // The QueryRunner uses the name of the index as constructor.
      // I use the same name as the database name.
      QueryRunner runner = new QueryRunner(&quot;web&quot;);
      // Call the runner to get the items.
      // Parameters are:
      // - ISearchParam: The search to perform
      // - Sitecore.Search.QueryOccurance: The AND/OR/NOT clause for the search
      // - ShowAllVersions: Get all versions of an item
      // - SortField: The name of the field used as my sort
      // - Reverse: Return items in reverse order (newset first)
      // - Start: Which items to return from the search result
      // - End: Which items to return from the search result
      IEnumerable&lt;SkinnyItem&gt; items = runner.GetItems(searchParam, Sitecore.Search.QueryOccurance.Must, false, &quot;date&quot;, true, 0, numberOfNews);
      return items.Select(item =&gt; Sitecore.Context.Database.GetItem(item.ItemID));
    }
  }
}</pre></p>
<p>All I need to do now is to create an <a href="http://www.w3schools.com/aspnet/aspnet_repeater.asp" target="_blank">asp:Repeater</a> and databind it to the function:</p>
<p><pre class="brush: csharp;">&lt;%@ Register TagPrefix=&quot;sc&quot; Namespace=&quot;Sitecore.Web.UI.WebControls&quot; Assembly=&quot;Sitecore.Kernel&quot; %&gt;

&lt;asp:Repeater ID=&quot;repNews&quot; DataSource=&quot;&lt;%# GetLatestNews(3) %&gt;&quot; runat=&quot;server&quot;&gt;
  &lt;HeaderTemplate&gt;
    &lt;ul&gt;
  &lt;/HeaderTemplate&gt;
  &lt;FooterTemplate&gt;
    &lt;/ul&gt;
  &lt;/FooterTemplate&gt;
  &lt;ItemTemplate&gt;
    &lt;li&gt;
      &lt;sc:FieldRenderer ID=&quot;FieldRenderer1&quot; FieldName=&quot;Date&quot; runat=&quot;server&quot; Item=&quot;&lt;%# Container.DataItem as Sitecore.Data.Items.Item %&gt;&quot; /&gt;
      &lt;a href=&quot;&lt;%# Sitecore.Links.LinkManager.GetItemUrl(Container.DataItem as Sitecore.Data.Items.Item) %&gt;&quot;&gt;
        &lt;sc:FieldRenderer ID=&quot;FieldRenderer2&quot; FieldName=&quot;Title&quot; runat=&quot;server&quot; Item=&quot;&lt;%# Container.DataItem as Sitecore.Data.Items.Item %&gt;&quot; /&gt;
      &lt;/a&gt;
    &lt;/li&gt;
  &lt;/ItemTemplate&gt;
&lt;/asp:Repeater&gt;</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/849/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=849&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2011/10/13/get-latest-news-using-sitecore-advanceddatabasecrawler-lucene-index/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>

		<media:content url="http://briancaos.files.wordpress.com/2011/10/newsarchive.jpg" medium="image">
			<media:title type="html">NewsArchive</media:title>
		</media:content>

		<media:content url="http://briancaos.files.wordpress.com/2011/10/newsarticle.jpg?w=500" medium="image">
			<media:title type="html">NewsArticle</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the Sitecore open source AdvancedDatabaseCrawler Lucene indexer</title>
		<link>http://briancaos.wordpress.com/2011/10/12/using-the-sitecore-open-source-advanceddatabasecrawler-lucene-indexer/</link>
		<comments>http://briancaos.wordpress.com/2011/10/12/using-the-sitecore-open-source-advanceddatabasecrawler-lucene-indexer/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 11:25:24 +0000</pubDate>
		<dc:creator>briancaos</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[Sitecore 6]]></category>
		<category><![CDATA[AdvancedDatabaseCrawler]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[Lucene]]></category>
		<category><![CDATA[Sitecore]]></category>

		<guid isPermaLink="false">http://briancaos.wordpress.com/?p=843</guid>
		<description><![CDATA[From Sitecore 6.5, Sitecore is deprecating the old Lucene search method. This simply means that you can no longer use the current, built in Lucene search, but has to use a new built in Lucene search. This is article 1 of 3 articles: Part 1 – Configuring the index: Using the Sitecore open source AdvancedDatabaseCrawler [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=843&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>From Sitecore 6.5, Sitecore is deprecating the <a href="http://sitecoreblog.alexshyba.com/2011/06/old-search-is-deprecated-in-sitecore-65.html" target="_blank">old Lucene search method</a>. This simply means that you can no longer use the current, built in Lucene search, but has to use a new built in Lucene search.</p>
<p>This is article 1 of 3 articles:</p>
<p><a href="http://briancaos.wordpress.com/2011/10/12/using-the-sitecore-open-source-advanceddatabasecrawler-lucene-indexer/" target="_blank">Part 1 – Configuring the index: Using the Sitecore open source AdvancedDatabaseCrawler Lucene indexer</a><br />
<a href="http://briancaos.wordpress.com/2011/10/13/get-latest-news-using-sitecore-advanceddatabasecrawler-lucene-index/" target="_blank">Part 2 &#8211; Simple search: Get latest news using Sitecore AdvancedDatabaseCrawler Lucene index</a><br />
<a href="http://briancaos.wordpress.com/2011/10/14/get-items-based-on-metadata-using-sitecore-advanceddatabasecrawler-lucene-index/" target="_blank">Part 3 &#8211; Multivalue search: Get items based on Metadata using Sitecore AdvancedDatabaseCrawler Lucene index</a></p>
<p>There are <a href="http://sitecoreblog.alexshyba.com/2011/02/8-reasons-to-use-new-search-in-sitecore.html" target="_blank">many good reasons</a> to use the new way of indexing, but it also requires you to redo some of your previous work. <a href="http://learnsitecore.cmsuniverse.net/en/Developers/Articles/2009/06/LuceneQuery3.aspx" target="_blank">The old way of indexing</a> was easy to setup and easy to use. The new way is more complex because it lets you do more advanced stuff.</p>
<p>That&#8217;s why <a href="http://sitecoreblog.alexshyba.com/" target="_blank">Alex Shyba</a> wrote an open source module that makes the searching and indexing easier: The <strong>Advanced Database Crawler</strong>. You can find the module here:</p>
<p style="text-align:center;"><a href="http://trac.sitecore.net/AdvancedDatabaseCrawler/browser/Branches/v2/">http://trac.sitecore.net/AdvancedDatabaseCrawler/browser/Branches/v2/</a></p>
<p>I have always felt that open source modules are the best way of implementing other developers unsolvable bugs. But I have tried this module, and it works.</p>
<p>I will now show you how to set up the module, and in 2 later posts, I will show you how to perform the 2 basic tasks that you do with an index: How to get the latest news, and how to get all items with a certain set of metadata categories.</p>
<p>The new indexing applies to newer versions of Sitecore. Sitecore 6.2 revision 5 should do it, but from 6.4 and forward you are certain that it will work.</p>
<p>First you need to compile the AdvancedDatabaseCrawler. When compiled you get some dlls:</p>
<ul>
<li>Sitecore.SharedSource.SearchCrawler.dll</li>
<li>Sitecore.SharedSource.SearchCrawler.DynamicFields.dll</li>
<li>Sitecore.SharedSource.SearchDemo.dll</li>
<li>Sitecore.SharedSource.Searcher.dll</li>
</ul>
<p>The Sitecore.SharedSource.SearchDemo.dll is not needed in production, but it implements some test pages (found in <strong>/sitecore modules/Web/searchdemo</strong>) that you can use to test your index. Copy the DLL&#8217;s to your Sitecore /bin/ folder and you are ready to go. Copy the /sitecore modules/Web/searchdemo items to test your index with Alex&#8217;s samples.</p>
<p>Now you need to set up an index. I will show you how to set up an index that crawls the <strong>WEB</strong> database, as I&#8217;m going to use the index for frontend indexing.</p>
<p>Create an ???.config file and put it in the <strong>/App_Config/Include</strong> folder. Add the following</p>
<p><pre class="brush: xml;">&lt;configuration xmlns:x=&quot;http://www.sitecore.net/xmlconfig/&quot;&gt;
  &lt;sitecore&gt;
    &lt;databases&gt;
      &lt;database id=&quot;web&quot; singleInstance=&quot;true&quot; type=&quot;Sitecore.Data.Database, Sitecore.Kernel&quot;&gt;
        &lt;Engines.HistoryEngine.Storage&gt;
          &lt;obj type=&quot;Sitecore.Data.$(database).$(database)HistoryStorage, Sitecore.Kernel&quot;&gt;
            &lt;param connectionStringName=&quot;$(id)&quot; /&gt;
            &lt;EntryLifeTime&gt;30.00:00:00&lt;/EntryLifeTime&gt;
          &lt;/obj&gt;
        &lt;/Engines.HistoryEngine.Storage&gt;
        &lt;Engines.HistoryEngine.SaveDotNetCallStack&gt;false&lt;/Engines.HistoryEngine.SaveDotNetCallStack&gt;
      &lt;/database&gt;
    &lt;/databases&gt;
    &lt;search&gt;
      &lt;configuration&gt;
        &lt;indexes&gt;
          &lt;index id=&quot;web&quot; type=&quot;Sitecore.Search.Index, Sitecore.Kernel&quot;&gt;
            &lt;param desc=&quot;name&quot;&gt;$(id)&lt;/param&gt;
            &lt;param desc=&quot;folder&quot;&gt;web&lt;/param&gt;
            &lt;Analyzer ref=&quot;search/analyzer&quot; /&gt;
            &lt;locations hint=&quot;list:AddCrawler&quot;&gt;
              &lt;master type=&quot;Sitecore.SharedSource.SearchCrawler.Crawlers.AdvancedDatabaseCrawler,Sitecore.SharedSource.SearchCrawler&quot;&gt;
                &lt;Database&gt;web&lt;/Database&gt;
                &lt;Root&gt;/sitecore/content&lt;/Root&gt;
                &lt;IndexAllFields&gt;true&lt;/IndexAllFields&gt;
                &lt;fieldCrawlers hint=&quot;raw:AddFieldCrawlers&quot;&gt;
                  &lt;fieldCrawler type=&quot;Sitecore.SharedSource.SearchCrawler.FieldCrawlers.LookupFieldCrawler,Sitecore.SharedSource.SearchCrawler&quot; fieldType=&quot;Droplink&quot; /&gt;
                  &lt;fieldCrawler type=&quot;Sitecore.SharedSource.SearchCrawler.FieldCrawlers.DateFieldCrawler,Sitecore.SharedSource.SearchCrawler&quot; fieldType=&quot;Datetime&quot; /&gt;
                  &lt;fieldCrawler type=&quot;Sitecore.SharedSource.SearchCrawler.FieldCrawlers.DateFieldCrawler,Sitecore.SharedSource.SearchCrawler&quot; fieldType=&quot;Date&quot; /&gt;
                  &lt;fieldCrawler type=&quot;Sitecore.SharedSource.SearchCrawler.FieldCrawlers.NumberFieldCrawler,Sitecore.SharedSource.SearchCrawler&quot; fieldType=&quot;Number&quot; /&gt;
                &lt;/fieldCrawlers&gt;
                &lt;!-- If a field type is not defined, defaults of storageType=&quot;NO&quot;, indexType=&quot;UN_TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; are applied--&gt;
                &lt;fieldTypes hint=&quot;raw:AddFieldTypes&quot;&gt;
                  &lt;!-- Text fields need to be tokenized --&gt;
                  &lt;fieldType name=&quot;single-line text&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;fieldType name=&quot;multi-line text&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;fieldType name=&quot;word document&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;fieldType name=&quot;html&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;fieldType name=&quot;rich text&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;fieldType name=&quot;memo&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;fieldType name=&quot;text&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;!-- Multilist based fields need to be tokenized to support search of multiple values --&gt;
                  &lt;fieldType name=&quot;multilist&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;fieldType name=&quot;treelist&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;fieldType name=&quot;treelistex&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;fieldType name=&quot;checklist&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                  &lt;!-- Legacy tree list field from ver. 5.3 --&gt;
                  &lt;fieldType name=&quot;tree list&quot; storageType=&quot;NO&quot; indexType=&quot;TOKENIZED&quot; vectorType=&quot;NO&quot; boost=&quot;1f&quot; /&gt;
                &lt;/fieldTypes&gt;
              &lt;/master&gt;
            &lt;/locations&gt;
          &lt;/index&gt;
        &lt;/indexes&gt;
      &lt;/configuration&gt;
    &lt;/search&gt;
  &lt;/sitecore&gt;
&lt;/configuration&gt;</pre></p>
<p>A short explanation:</p>
<p>The <strong>/sitecore/databases/database</strong> items creates a HistoryEngine on the WEB database. This is needed for indexing at all. No HistoryEngine, no index.</p>
<p>The <strong>/sitecore/search/configuration/indexes/index</strong> is the actual index. This is taken straight from Alex Shyba&#8217;s own examples and defines an index called &#8220;<strong>web</strong>&#8221; that contains everything (all items, all fields) from the <strong>WEB</strong> database.</p>
<p><a href="http://sdn.sitecore.net/upload/sitecore6/sitecore_search_and_indexing-a4.pdf" target="_blank">Read more about setting up indexes here</a>.</p>
<p>This it it. You cannot use Sitecore to rebuild the index anymore. You need to either use the <strong>/sitecore modules/Web/searchdemo/RebuildDatabaseCrawlers.aspx</strong> or write your own simple code:</p>
<p><pre class="brush: csharp;">JobOptions options = new JobOptions(&quot;RebuildSearchIndex&quot;, &quot;index&quot;, Sitecore.Client.Site.Name, &quot;web&quot;, &quot;Rebuild&quot;);
options.AfterLife = TimeSpan.FromMinutes(1.0);
Job job = JobManager.Start(options);</pre></p>
<p>In the following posts I will demonstrate how to get the latest news, and how to get all items with a certain set of metadata categories.</p>
<p>More stuff to read:</p>
<ul>
<li><a href="http://sitecoreblog.alexshyba.com/2011/04/search-index-troubleshooting.html" target="_blank">Search Index Troubleshooting</a></li>
<li><a href="http://sitecoreblog.alexshyba.com/2011/02/8-reasons-to-use-new-search-in-sitecore.html" target="_blank">8 reasons to use the new search in Sitecore</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/briancaos.wordpress.com/843/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/briancaos.wordpress.com/843/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/briancaos.wordpress.com/843/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/briancaos.wordpress.com/843/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/briancaos.wordpress.com/843/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/briancaos.wordpress.com/843/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/briancaos.wordpress.com/843/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/briancaos.wordpress.com/843/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/briancaos.wordpress.com/843/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/briancaos.wordpress.com/843/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/briancaos.wordpress.com/843/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/briancaos.wordpress.com/843/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/briancaos.wordpress.com/843/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/briancaos.wordpress.com/843/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=briancaos.wordpress.com&amp;blog=4258391&amp;post=843&amp;subd=briancaos&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://briancaos.wordpress.com/2011/10/12/using-the-sitecore-open-source-advanceddatabasecrawler-lucene-indexer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25db0dbe9728e65c205cb902b4aa9741?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">briancaos</media:title>
		</media:content>
	</item>
	</channel>
</rss>
