Sorting by text properties in MOSS 2010 requires checking the option “Reduce storage requirements…”

Posted on July 4, 2010

0


After migrating some code from MOSS 2007 to 2010 it turned out that running search queries with the ORDER BY clause with a text property (e.g. Title) an exception was thrown by SharePoint. This appeared in the ULS logs as:

SearchServiceApplicationProxy::Execute–Error occured: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Exception from HRESULT: 0x80040E60 (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80040E60 at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.Office.Server.Search.Query.FullTextSqlQueryInternal.Execute() at Microsoft.Office.Server.Search.Query.QueryInternal.Execute(QueryProperties properties) at Microsoft.Office.Server.Search.Administration.SearchServiceApplication.Execute(QueryProperties properties) at SyncInvokeExecute(Object , Object[] …, Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)…).

After some research it turned out that text properties in MOSS 2010 must have the option “Reduce storage requirements for text properties by using a hash for comparison” checked as shown below:

OptimizeTextPropertyOptions

Analyzing the source code (using .NET Reflector) of the ManagedProperty.aspx page (at C:\Windows\assembly\GAC_64\Microsoft.Office.Server.Search\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Server.Search.dll) I found out that such option corresponded to setting MaxCharactersInPropertyStoreIndex=64 on the managed property. Below follows the corresponding block of the OkButtonClicked method:

if ((this.type == ManagedDataType.Text) && !this.property.RetrievableForResultsOnly)
{
if (this.sortableCheckBox.Checked) {
this.property.MaxCharactersInPropertyStoreIndex = 0x40; //64
}
else { this.property.MaxCharactersInPropertyStoreIndex = 0; } 
...

Advertisements
Posted in: SharePoint