eZ Community » Forums » eZ Publish 5 Platform » GROUP BY in SearchService?
expandshrink

GROUP BY in SearchService?

GROUP BY in SearchService?

Tuesday 16 June 2015 11:49:13 am - 2 replies

I need to group articles by day, based in the publish date. While there is a SortClause in SearchService, I have not found a grouping. Any suggestions or workarounds?

Thanks!

Thursday 18 June 2015 11:35:53 am

As mentioned on Slack, there is no such thing currently in the SearchService. Newer versions of Solr do support something like that but its hard to say when this will be supported in the Public API.

Thursday 18 June 2015 2:32:32 pm

Hi Ivo

thanks for your comment. I was suspecting this.

As a reference for others, here is how I solved the problem. Given the small number of records to process (I fetch bunches of 20 objects, sorted by publish date), I do the grouping in PHP with this simple trick:

$date = date_format( $content->contentInfo->publishedDate, 'Y-m-d' );
$items[$date][] = $content;

Cheers,
Donat

Modified on Thursday 18 June 2015 2:32:58 pm by Donat Fritschy

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from