Gravatar for josh.bair@gmail.com

Question by jbairuc, Jul 27, 2016 8:37 PM

Sitecore for Coveo: Getting the raw API response?

When performing a query after creating your search context and assigning the items to a list of SearchResultItem, is the response the API came back with available anywhere?

For example, at Break Point A or Break Point B below, is there anything that contains the raw response? I've dug through a lot of sessions in the Watch window but haven't seen anything that has the API response or even the translated query

    IQueryable<SearchResultItem> queryable;

using (var context = index.CreateSearchContext())
{
    // Cast the search context in a Coveo search context to use CustomSearchOptions
    ICoveoSearchContext coveoContext = context as ICoveoSearchContext;
    // Add the external collection in the search context. It will be used in OR with the automatic source filter for the index 
    coveoContext.SearchContextOptions = new CoveoSearchContextOptions { ExternalCollections = new List<string>() { "External Content" } };

    /** Break Point A **/

    // Perform the query
    queryable = context.GetQueryable<ExtendedSearchResultItem>().Where(predicate);

    /** Break Point B **/

    // ... 
}
1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Jul 28, 2016 8:35 AM

Hi Josh,

In Coveo for Sitecore 3.0, there is no way to get the original query response or additional metadata on the query or results.

However, in Coveo for Sitecore 4.0, there are ways to access those:

  • https://developers.coveo.com/display/SitecoreV4/Retrieving+Metadata+in+LINQ+Query+Results
  • https://developers.coveo.com/display/SitecoreV4/Using+QueryResults+to+Retrieve+Query+Metadata

I hope this helps

Jeff

Ask a question