FIX: Error when you search multiple products in Commerce Server 2009 if the SearchCriteria.CategoriesClause property is configured for multiple category searches

Applies to: Commerce Server 2009 EnterpriseCommerce Server 2009 Standard

Symptoms


Consider the following scenario:
  • You have a computer that is running Microsoft Commerce Server 2009.
  • You configure the SearchCriteria.CategoriesClause parameter so that a CommerceQuery operation searches products across multiple categories. For example, you configure the SearchCriteria.CategoriesClause parameter by using the following syntax:
    query.SearchCriteria.CategoriesClause = "[IsSearchable] = 1"; 
  • You start the CommerceQuery operation that returns multiple Commerce Server products from multiple categories on a Commerce Server site.
In this scenario, you receive an error message that resembles the following on the Commerce Server site:
Exception Details: System.ServiceModel.FaultException`1[[Microsoft.Commerce.Contracts.Faults.GeneralOperationFault, Microsoft.Commerce.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: The operation service has encountered an error while processing the request. The error details have been logged by the service.

Source Error:

Line 49: ParameterChecker.CheckForNull(operation, "operation");
Line 50:
Line 51: return CommerceFoundationServiceAgent.operationServiveAgent.ProcessRequest(
Line 52: GetCurrentRequestContext(), operation.ToRequest());
Line 53: }


Source File: C:\CS2009\Catalog\Components\CommerceFoundationServiceAgent.cs Line: 51

Stack Trace:


[FaultException`1: The operation service has encountered an error while processing the request. The error details have been logged by the service.]
Microsoft.Commerce.Broker.OperationService.ProcessRequest(CommerceRequest request) +697
Microsoft.Commerce.Common.OperationServiceAgent.ProcessRequest(CommerceRequestContext requestContext, CommerceRequest request) +154
Microsoft.Samples.Commerce.Catalog.CommerceFoundationServiceAgent.Execute(CommerceBaseBuilder operation) in C:\CS2009\Catalog\Components\CommerceFoundationServiceAgent.cs:51
Microsoft.Samples.Commerce.Catalog.SimpleSearch.BtnSearch_Click(Object sender, EventArgs e) in C:\CS2009\Catalog\SimpleSearch.aspx.cs:76
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981

Additionally, the following error message is logged in the SQL Server error log file:
Msg 2627, Level 14, State 1, Line 1 Violation of UNIQUE KEY constraint 'UQ__CtlInv____<text>'. Cannot insert duplicate key in object 'dbo.CtlInv___CategorySearch___SortedResults__for_spid__<spid>'. The statement has been terminated.

Cause


This issue occurs because of an error in the ctlg_FillCategoryDescendants stored procedure.

Resolution


Hotfix information


A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website: Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.


Prerequisites

To apply this hotfix, you must have Microsoft Commerce Server 2007 Service Pack 2 (SP2) installed.

Restart requirement

You do not have to restart the computer after you apply this hotfix. However, you must restart Internet Information Services (IIS) and the Commerce Server Catalog Import Host COM+ application after you apply this hotfix.

To restart IIS, type the following command at a command prompt, and then press ENTER:
IISRESET /RESTART

Note This command stops and then restarts all IIS services that are running on a computer.

Hotfix replacement information

This hotfix does not replace any other hotfix.

Installation steps

This hotfix package contains the following files:
  • CommerceServer2007SP3-KB2498781-ENU.exe
  • KB2498781.sql
  • hotfix.txt
To prevent the occurrence of this issue in new catalog databases, run the CommerceServer2007SP3-KB2498781-ENU.exe file to update the Catalogcreate.sql file for Commerce Server 2009.

To resolve this issue, run the KB2498781.sql file against the existing catalog databases.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
Commerce Server 2009
File nameFile versionFile sizeDateTimePlatform
Catalogcreate.sqlNot applicable1,156,49814-Dec-201208:37Not applicable
Cs2009hotfixhelper.exe6.0.4171.9612,87214-Dec-201209:14x86


Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References


For more information about the CommerceQuery operation, visit the following Microsoft Developer Network (MSDN) website:For more information about the CategoriesClause property, visit the following MSDN website: