Wednesday 13 July 2011

Lucene: Compression support not configured

I got this error when trying to extract Hits.Doc from Lucene:

Compression support not configured

at SupportClass.CompressionSupport.CheckCompressionSupport()
at SupportClass.CompressionSupport.Uncompress(Byte[] input)
at Lucene.Net.Index.FieldsReader.Uncompress(Byte[] input)
at Lucene.Net.Index.FieldsReader.AddField(Document doc, FieldInfo fi, Boolean binary, Boolean compressed, Boolean tokenize)
at Lucene.Net.Index.FieldsReader.Doc(Int32 n, FieldSelector fieldSelector)
at Lucene.Net.Index.SegmentReader.Document(Int32 n, FieldSelector fieldSelector)
at Lucene.Net.Index.IndexReader.Document(Int32 n)
at Lucene.Net.Search.IndexSearcher.Doc(Int32 i)
at Lucene.Net.Search.Hits.Doc(Int32 n)


The solution was to add the following missing keys into Sitecore AppSettings.config:

<add key="Lucene.Net.FSDirectory.class" value="Sitecore.Data.Indexing.FSDirectory, Sitecore.Kernel" />
<add key="Lucene.Net.CompressionLib.class" value="Sitecore.IO.Compression, Sitecore.Kernel" />

Tuesday 17 May 2011

The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.

I get this error from time to time when editing plain text files in Visual Studio. I tried correcting it by going to File, Save As, Save with Encoding (in the Save dropdown). This seemed to do the trick about 50% of the time. However, it would seem this was just coincidence. Latest findings suggest it is a Firefox cache problem. I tried the same URL in another browser and it worked. Fingers crossed this is a fix.

Friday 14 January 2011

Non white space characters cannot be added to content.

When trying to initialise an XDocument with a string containing XML, I kept getting the error:

Unhandled Exception: System.ArgumentException: Non white space characters cannot be added to content.

With help from a colleague, and recalling how I'd got around this error previously, the solution is to use the static XDocument.Parse( string ) method. Eg:

var myXDoc = XDocument.Parse( xmlString );