Coveo for Sitecore 5 is now available!

Slow Queries in a Coveo Search Page

Symptoms

When executing a query in a Coveo Search Page, search results may take a considerable amount of time before they are returned.

Causes

Slow queries can be caused by a number of factors:

  1. Low performance hardware. For example, virtualized servers are known to be slower than physical ones. Also, indexes containing a lot of documents are typically slower than smaller ones.
  2. High network latency. This slows down communications between Coveo for Sitecore and the Coveo Search API, so your queries take a longer time to return search results.
  3. Overly complex query expressions. For example, query expressions containing wildcards are a common cause of bad query performance.

    Wildcard query expressions are field queries that use the *= operator and one or more star (*) or question mark (?) character in the value.

    Example of a wildcard query expression

     @fz95xfullpath56518*="/sitecore/content/Home*"
    

    Before the April 2015 release of Coveo for Sitecore, the where the item is the specific item or one of its subitems filtering rule was generating a wildcard query on the _fullpath field as in the previous example.

Resolution

  1. Low performance hardware: see with your IT administrator.
  2. High network latency: see with your IT administrator.
  3. Overly complex query expressions:
    1. Whenever possible, avoid using wildcards in query expressions. Instead, use exact match expressions (e.g., @field=="value") or basic “contains” expressions (e.g., @field="value") for better performance.
    2. If you are using a release earlier than Coveo for Sitecore April 2015 Monthly Release (3.0.1000) and the where the item is the specific item or one of its subitems filtering rule:
      1. The best solution is to upgrade Coveo for Sitecore to the April 2015 release or newer. These releases are not using the wildcard query expressions anymore in the where the item is the specific item or one of its subitems filtering rule. Coveo for Sitecore now uses an exact match query on the _path field.
      2. If an upgrade is not possible, you can stop using the where the item is the specific item or one of its subitems rules and convert them to where specific field compares to specific value rules:
        1. Ensure the _path field is configured as a multi-value facet field:
          1. Open your Coveo.SearchProvider.config file in a text editor.
          2. Ensure that the <fieldType fieldName="_path"... /> element is present and has the isFacet="true" and isMultiValue="true" attributes and values in the <fieldNames ...> element like the example below.

            1. If the element is missing, create it.

            2. If its isFacet and isMultiValue attributes are not set to true, set them to true like in the example below.

               <fieldMap type="Coveo.SearchProvider.CoveoFieldMap, Coveo.SearchProvider">
                 ...
                 <fieldNames hint="raw:AddFieldByFieldName">
                   ...
                   <fieldType fieldName="_path" isFacet="true" isMultiValue="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
                   ...
                 </fieldNames>
                 ...
               </fieldMap>
              
          3. Save and close the file.

          4. If you created the field or changed its configuration, rebuild the Sitecore indexes to synchronize the field configuration with CES.
        2. Replace any use of the where the item is the specific item or one of its subitems filtering rule with the where specific field compares to specific value filtering rule:
          • Field: _path
          • Compares to: is equal to
          • Specific value: short GUID of the root item to display
        3. If you have a where the item is the Home item or one of its subitems filtering rule, you should change it for a where _path field is equal to 110D559FDEA542EA9C1C8A5DF7E70EF9 filtering rule where the Home item short GUID is 110D559FDEA542EA9C1C8A5DF7E70EF9.