Slow Queries in a Coveo-Powered Search Page
Slow Queries in a Coveo-Powered Search Page
Symptoms
When executing a query in a Coveo-Powered Search Page, search results may take a considerable amount of time before they’re returned.
Causes
Slow queries can be caused by a number of factors:
-
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.
-
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.
-
Overly complex query expressions. For example, query expressions containing wildcards are a common cause of bad query performance.
NoteWildcard 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 subitemsfiltering rule was generating a wildcard query on the_fullpathfield as in the previous example.
Resolution
-
Low performance hardware: see with your IT administrator.
-
High network latency: see with your IT administrator.
-
Overly complex query expressions:
-
Whenever possible, avoid using wildcards in query expressions. Instead, use exact match expressions (for example,
@field=="value") or basic "contains" expressions (for example,@field="value") for better performance. -
If you’re 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 subitemsfiltering rule:-
The best solution is to upgrade Coveo for Sitecore to the April 2015 release or newer. These releases aren’t using the wildcard query expressions anymore in the
where the item is the specific item or one of its subitemsfiltering rule. Coveo for Sitecore now uses an exact match query on the_pathfield. -
If an upgrade isn’t possible, you can stop using the
where the item is the specific item or one of its subitemsrules and convert them towhere specific field compares to specific valuerules:-
Ensure that the
_pathfield is configured as a multi-value facet field:-
Open your
Coveo.SearchProvider.configfile in a text editor. -
Ensure that the
<fieldType fieldName="_path"... />element is present and has theisFacet="true"andisMultiValue="true"attributes and values in the<fieldNames ...>element like the example below.-
If the element is missing, create it.
-
If its
isFacetandisMultiValueattributes aren’t set totrue, set them totruelike 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>
-
-
Save and close the file.
-
If you created the field or changed its configuration, rebuild the Sitecore indexes to synchronize the field configuration with CES.
-
-
Replace any use of the
where the item is the specific item or one of its subitemsfiltering rule with thewhere specific field compares to specific valuefiltering rule:-
Field:
_path -
Compares to: is equal to
-
Specific value: short GUID of the root item to display
-
-
If you have a
where the item is the Home item or one of its subitemsfiltering rule, you should change it for awhere _path field is equal to 110D559FDEA542EA9C1C8A5DF7E70EF9filtering rule where the Home item short GUID is 110D559FDEA542EA9C1C8A5DF7E70EF9.
-
-
-