How does Sitecore ContentSearch determine which index to use

In the official documentation you can read that Sitecore will choose index based on the RootPath in the crawler and based on the placing in the web.config.

Basically if you create an index that indexes everything under /sitecore/content/home/products you will need to get that index defined before for example the master index in the web.config otherwise your new index will not be considered at all. But what does actually happen here? Continue reading

Adding a second master database

Have you ever wanted to add a second database so you can keep millions of items in it and not having to publish it?

Well, to be honest me neither until a few days ago. The scenario is that you have lots and lots of data in other systems (PIM, DAM, Pdf-library or whatever). You want this data to be accessible in Sitecore but you do not want to publish it since that will take forever and cause all sorts of problems.

So in this case you could keep all that data in the second master database (in a bucket of course, since the content tree will be quite hard to handle otherwise). Continue reading

Simple custom field with working link database

So you have created a great new custom field that links items to items, but it is not working with the link database? Well the fix is not that hard. One way of getting around the problem and getting the custom field to register the links in the link database is to inherit the class CustomField and overriding the ValidateLinks, UpdateLink, Relink and RemoveLink methods. Continue reading

ProductTypeResultHeader

How to create a Computed index field

In Sitecore 7.1 the new indexes are very powerful and allow you to do stuff easily that in Sitecore 6 took quite an effort. An example of that is if you want to tag items and show lists of the items based on the tagging. This can be achieved with a computed index field and some good old Sitecore work. So lets look at the first part of the task and add a tag to the index at hand. Continue reading

Workflow on standard values mistake

Last week when I was setting up workflows for my customer I made a mistake that had some interesting side effects that were not all that predictable. When i added the workflow to the standard values of the template I was in a bit of a rush (that is my story and I am sticking to it) and I added the workflow to the field called “Workflow” to the standard values of the template. Just to really make sure that it would be in the right workflow state upon creating an item based on the template I added the first state to the field “State” as well. Continue reading

RedirectFeature

Redirect with customizable redirect headers

The aliases provided by Sitecore provide the same basic functionality, but they will not get you very far if you want to be a bit more advanced and allow the administrators to select the type of redirect or expand the redirect functionality in some other way.

The solution is to create your own redirect functionality which is quite easily achieved by adding some templates and adding a pipeline to the httpRequestBegin processors. Continue reading

MediaUrl2

A very simple media upload via URL

The media upload functionality in Sitecore only handles direct file upload while you sometimes would like to add a media item from the Internet. There are for example Digital Asset Management (DAM) systems that use URL cut and pasting as a means of integration.

The drawbacks of this method of integration is that the web site will depend on the media being available from the DAM system which it may not always be. If for example the DAM is down a single point of failure is introduced in the web site. If the editors remove an image from the DAM system they will have no way of knowing that an image actually is used in a web site. I personally do not think that URL cutting and pasting is a good way of integrating a DAM system, but sometimes you have to deal with the systems already out there. Continue reading

Replace white space in media URLs in Sitecore

When the users create media items and media folders in Sitecore that contain white space all media URLs will also contain white spaces. This is apparently frowned upon by W3C and their html-validator.

One would think that the normal <encodeNameReplacements> in web.config also handles media URLs, but it does not. It is however realtively simple to override the GetMediaUrl(…) that Sitecore uses without being too intrusive. Continue reading