Sitecore’s SearchHits.Slice(int) method seems to change in Sitecore 6.6

I am working on a Sitecore 6.6 upgrade (yes, I know that that is still pretty much obsolete) and I came across a weird bug that took an age to track down. This is more a reminder for myself than anything else.

The code for Lucene searches frequently used lines of the form:

Slice Capture

List<SearchHit> distinctHits = hits.Slice(0).Distinct(new SearchHitEqualityComparer()).ToList();

This always returned zero SearchHits. It seems that this is due to the call to ‘Slice(0)‘ bit. This does raise some questions… Continue reading “Sitecore’s SearchHits.Slice(int) method seems to change in Sitecore 6.6” →

Sitecore’s SearchHits.Slice(int) method seems to change in Sitecore 6.6

Enable SSL for sending emails on Sitecore

I was asked to use a GMail server to send emails from Sitecore with. This is actually a pretty reasonable request – but GMail only supports connections over TLS or SSL. Configuring Web Forms for Marketers to use this was proving … interesting, until I found this excellent article by Mark Cassidy.  Continue reading “Enable SSL for sending emails on Sitecore” →

Enable SSL for sending emails on Sitecore

Make Sitecore record the class writing to the logs

I’m a big fan of writing into your logs the class and method that is currently executing – it makes fault finding so much easier. Typically I’d do this with reflection – but it turns out that you can do this with a small change to Sitecore’s configuration.  Continue reading “Make Sitecore record the class writing to the logs” →

Make Sitecore record the class writing to the logs

Appending to the _content field in Sitecore Search 7.2 and 7.5

The _content field in Lucene for Sitecore is basically the full text index. If you index things like PDFs, Word documents, etc., then the results of the IFilter get stored in the _content field.

You can add computed fields into the _content field simply by specifying them with the name ‘_content’. However, I found some differences with how patch files behave.  Continue reading “Appending to the _content field in Sitecore Search 7.2 and 7.5” →

Appending to the _content field in Sitecore Search 7.2 and 7.5

Awkward Sitemap XML module

So, I was reviewing a few Sitecore log files for a customer of ours, and I kept coming across the following entries.

ManagedPoolThread #15 10:26:56 WARN The serachengine "Http://google.com/webmasters/sitemaps/ping?sitemap=sitemap.xml" returns an 404 error
ManagedPoolThread #15 10:26:57 WARN The serachengine "http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=sitemap.xml" returns an 404 error

Capture2
This struck me as interesting. These are calls to different search providers to tell them that your site’s sitemap file has been updated, and should be read again (so that new content could be indexed). This is all from a nice little module on Sitecore Marketplace. We use it quite a lot. However, I spotted a few issues… Continue reading “Awkward Sitemap XML module” →

Awkward Sitemap XML module

Programmatically reset a a Sitecore Item’s presentation details

Just a quick post – should you need to reset an item back to using the controls defined on its template’s standard values, you can easily achieve this through code:

using (new Sitecore.SecurityModel.SecurityDisabler())
{
using (new Sitecore.Data.Items.EditContext(item))
{
item.Fields["__renderings"].Reset();
}
}

I’ve tried it, and it worked.

Programmatically reset a a Sitecore Item’s presentation details

Sitecore – Switching Indexes on Rebuild

The project I’m working on makes fairly extensive use of Sitecore’s search functionality, and I realised that one problem I could foresee was that of Index updates. When rebuilding the search index, by default Sitecore deletes the existing index, and then builds a new one. While this is going on, search is not available. That’s not really acceptable… Continue reading “Sitecore – Switching Indexes on Rebuild” →

Sitecore – Switching Indexes on Rebuild