/**
  * {@inheritdoc}
  */
 public function handle(CriteriaPartInterface $criteriaPart, Criteria $criteria, Search $search, ShopContextInterface $context)
 {
     $aggregation = new TermsAggregation('manufacturer');
     $aggregation->setField('manufacturer.id');
     $aggregation->addParameter('size', self::AGGREGATION_SIZE);
     $search->addAggregation($aggregation);
 }
 /**
  * Tests setOrder DESC method.
  */
 public function testTermsAggregationSetOrderDESC()
 {
     // Case #7 terms aggregation with order term mode, desc direction.
     $aggregation = new TermsAggregation('test_agg');
     $aggregation->setField('test_field');
     $aggregation->addParameter('order', ['_term' => 'desc']);
     $result = ['terms' => ['field' => 'test_field', 'order' => ['_term' => 'desc']]];
     $this->assertEquals($aggregation->toArray(), $result);
 }