Skip to content

Commit

Permalink
fixup! fixup! EZP-32110: Access additional search result data from Pa…
Browse files Browse the repository at this point in the history
…gefanta adapters (unit tests + CS)
  • Loading branch information
adamwojs committed Dec 19, 2020
1 parent 689f848 commit 76c4336
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract class AbstractSearchResultAdapter implements AdapterInterface, SearchRe
/** @var \eZ\Publish\API\Repository\Values\Content\Search\AggregationResultCollection|null */
private $aggregations;

/** @var int|null */
/** @var float|null */
private $time;

/** @var bool|null */
Expand Down Expand Up @@ -113,7 +113,6 @@ public function getAggregations(): AggregationResultCollection
$aggregationQuery = clone $this->query;
$aggregationQuery->offset = 0;
$aggregationQuery->limit = 0;
$aggregationQuery->performCount = false;

$searchResults = $this->executeQuery(
$this->searchService,
Expand All @@ -127,7 +126,7 @@ public function getAggregations(): AggregationResultCollection
return $this->aggregations;
}

public function getTime(): ?int
public function getTime(): ?float
{
return $this->time;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getAggregations(): AggregationResultCollection
return $this->searchResult->aggregations;
}

public function getTime(): ?int
public function getTime(): ?float
{
return $this->searchResult->time;
}
Expand Down
2 changes: 1 addition & 1 deletion eZ/Publish/Core/Pagination/Pagerfanta/Pagerfanta.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function getAggregations(): AggregationResultCollection
return $this->getAdapter()->getAggregations();
}

public function getTime(): ?int
public function getTime(): ?float
{
return $this->getAdapter()->getTime();
}
Expand Down
4 changes: 2 additions & 2 deletions eZ/Publish/Core/Pagination/Pagerfanta/SearchResultAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public function getAggregations(): AggregationResultCollection;
/**
* Get the duration of the search processing for current results slice (in ms).
*
* @return int|null
* @return float|null
*/
public function getTime(): ?int;
public function getTime(): ?float;

/**
* Indicates if the search has timed out for current results slice.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ContentSearchHitAdapterTest extends TestCase
];

private const EXAMPLE_RESULT_MAX_SCORE = 5.123;
private const EXAMPLE_RESULT_TIME = 30;
private const EXAMPLE_RESULT_TIME = 30.0;

/** @var \eZ\Publish\API\Repository\SearchService|\PHPUnit\Framework\MockObject\MockObject */
protected $searchService;
Expand Down Expand Up @@ -139,7 +139,6 @@ public function testGetAggregations(): void
$aggregationQuery = clone $query;
$aggregationQuery->offset = 0;
$aggregationQuery->limit = 0;
$aggregationQuery->performCount = false;

$searchResult = new SearchResult([
'searchHits' => [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LocationSearchHitAdapterTest extends TestCase
];

private const EXAMPLE_RESULT_MAX_SCORE = 5.123;
private const EXAMPLE_RESULT_TIME = 30;
private const EXAMPLE_RESULT_TIME = 30.0;

/** @var \eZ\Publish\API\Repository\SearchService|\PHPUnit\Framework\MockObject\MockObject */
protected $searchService;
Expand Down Expand Up @@ -143,7 +143,6 @@ public function testGetAggregations(): void
$aggregationQuery = clone $query;
$aggregationQuery->offset = 0;
$aggregationQuery->limit = 0;
$aggregationQuery->performCount = false;

$searchResult = new SearchResult([
'searchHits' => [],
Expand Down
2 changes: 1 addition & 1 deletion eZ/Publish/Core/Pagination/Tests/PagerfantaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

final class PagerfantaTest extends TestCase
{
private const EXAMPLE_TIME_RESULT = 30;
private const EXAMPLE_TIME_RESULT = 30.0;
private const EXAMPLE_MAX_SCORE_RESULT = 5.12354;

/** @var \eZ\Publish\Core\Pagination\Pagerfanta\SearchResultAdapter|\PHPUnit\Framework\MockObject\MockObject */
Expand Down
Binary file not shown.

0 comments on commit 76c4336

Please sign in to comment.