Gravatar for

Question by silin, Jul 12, 2017 2:58 PM

Access child results in CoveoProcessParsedRestResponse pipeline

I am using Folding component and need to do some manipulations with results before displaying them on UI. Trying to use CoveoProcessParsedRestResponse pipeline. Results are accessed using args.ResponseContent.Results property, which is collection of Coveo.SearchProvider.Rest.Serialization.SearchResult. The problem is that I can not find property for child results in SearchResult class.

Is there a way to access child results in CoveoProcessParsedRestResponse pipeline?

1 Reply
Gravatar for

Answer by François Lachance-Guillemette, Jul 12, 2017 3:33 PM

To answer your question, `SearchResult` is a dictionary, you can access the `childResults` and `parentResult` variables with a simple `SearchResult["childResults"]`. You will have to parse them yourself, but it should work.

I would also like to suggest a client-side alternative with the preprocessResults event. You have access to all the results and children in there :)

But what are you trying to achieve exactly? Most of the time, it is better to add a computed field than trying to compute a value with the returned values.

Gravatar for

Comment by silin, Jul 12, 2017 4:24 PM

Thank you, that worked.

I am using Folding component but need to display set of results as a single result. For end user the whole set is a single page on the website. The goal is to combine excerpts of child results into parent`s excerpt and display only parent result. It is related to my other question:

Ask a question