/**
  * Data provider for testTopHitsAggregation.
  *
  * @return array
  */
 public function getTopHitsAggregationData()
 {
     $out = [];
     // Case #0 simple top hits aggregation with default values.
     $aggregation = new TopHitsAggregation('test-top_hits');
     $expectedHits = [3, 2, 1];
     $out[] = ['aggregation' => $aggregation, 'expectedHits' => $expectedHits];
     // Case #1 top hits aggregation with sort.
     $sorts = new Sorts();
     $sorts->addSort(new Sort('price', Sort::ORDER_ASC));
     $sorts->addSort(new Sort('title', Sort::ORDER_DESC));
     $aggregation = new TopHitsAggregation('test-top_hits', null, null, $sorts);
     $expectedHits = [1, 2, 3];
     $out[] = ['aggregation' => $aggregation, 'expectedHits' => $expectedHits];
     // Case #2 top hits aggregation with from.
     $aggregation = new TopHitsAggregation('test-top_hits', null, 2, null);
     $expectedHits = [1];
     $out[] = ['aggregation' => $aggregation, 'expectedHits' => $expectedHits];
     // Case #3 top hits aggregation with size.
     $aggregation = new TopHitsAggregation('test-top_hits', 2);
     $expectedHits = [3, 2];
     $out[] = ['aggregation' => $aggregation, 'expectedHits' => $expectedHits];
     return $out;
 }
 /**
  * {@inheritdoc}
  */
 public function addBuilder(BuilderInterface $builder, $parameters = [])
 {
     $this->sorts->addSort($builder);
 }