Getting Faster Results With the Coveo for Salesforce Free Edition

When comparing the query speed of the Coveo for Salesforce Free edition to the out-of-the-box Salesforce search, you might notice that it takes longer for results to be returned in Free. This is because the Coveo for Salesforce Free edition queries the Salesforce index oftentimes through many SOQL or SOSL queries, thus taking longer to return results than the out-of-the-box Salesforce search (see Understanding the Coveo for Salesforce Free Edition Architecture).

However, there are ways to alleviate the number of SOQL or SOSL queries sent to the Salesforce index, allowing you to make your queries run faster.

This isn’t an issue with Coveo for Salesforce Pro and Enterprise, as the query is sent to the Coveo index instead of the Salesforce index, making results return faster and more efficiently (see Understanding the Coveo for Salesforce Pro and Enterprise Architecture).

Reduce the Number of Queried Objects

As you may already know, you need to specify which objects you want results from in your search page (see Using Custom Objects With the Coveo for Salesforce Free Edition). This is because a different Salesforce query needs to be performed for every object that you specify.

Thus, the first and fastest step to making your results run faster is to review the objects that you query in your search component, and lower it as much as possible. Those objects are declared in the @objecttype==() section of the query.

You can view the final query your component sends in the Network tab of your browser Developer Console. For each performed query, two v2/ events are sent. The second one contains the sent query.

Review the SOQL or SOSL Query Coveo Sends to Salesforce

If, after reviewing the number of queried objects, you want to make sure that no unnecessary object is still queried, you might want to verify the SOQL or SOSL query Coveo sends to the Salesforce index. At the same time, you’ll be able to see the time it takes for Salesforce to return results to the query Coveo performs.

  1. In Salesforce, access the Coveo component you want to review.

  2. Press the Alt key and double click a Coveo component on your search page. An example of a component to click would be a result, a facet header, or the Coveo search box.

    This should open a window giving you more information on that component.

  3. At the top of the newly opened window, check the Enable query debug option.

  4. Open your browser Developer Console, and perform another search.

  5. In the Network tab of your browser Developer Console, select the last v2/ event sent, and select its Response.

  6. In the Response tab, search for the Batch Query element. The following template will help you understand what this section means.

     "children": [
         {
             "description": "Batch Query",
             "duration": Time (ms) it took for Salesforce to return the results,
             "result": {
                 "in": {
                     "main": [
                         "SOSL or SOQL queries performed by Coveo"
                     ]
                 },
                 "out": {
                     "main": {
                         "count": Number of results returned
                     }
                 }
             }
         }
     ]
    

With this information, you might be able to reduce the number of SOQL and SOSL queries performed by Coveo to Salesforce. Consider changing the query your component perform.

For help on how to understand the Coveo Query syntax, see Coveo Query Syntax Examples in Coveo for Salesforce.

Recommended Articles