Gravatar for ratnakumar.ravva@accenture.com

Question by ratnakumar_ravva, Aug 21, 2015 3:05 AM

How to use groupby with two more fields ?

Hi Everyone, I want to get result base on groupby with two or more fields. I'm getting results, when i used groupby with one field.

This is the query for groupby with single field. http://server/rest/search/?q=tempo&groupBy=[{"field":"@sysfiletype","maximumNumberOfValues":6,"sortCriteria":"AlphaDescending","injectionDepth":1000}]

Please let me know the syntax to use multiple groupby fields in the query.

Thanks.

1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Aug 21, 2015 3:12 AM

GroupBy/facets can only work on one field at a time, but you can include multiple group by requests to list the values of several fields in a single operation.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Aug 21, 2015 9:40 AM

To have more than one facet as Martin is suggesting, you can write your query like this:

http://server/rest/search/?q=tempo&groupBy=[{"field":"@FirstFacetField","maximumNumberOfValues":6,"sortCriteria":"AlphaDescending","injectionDepth":1000},{"field":"@SecondFacetField","maximumNumberOfValues":6,"sortCriteria":"AlphaDescending","injectionDepth":1000}]

Ask a question