|
@@ 4429-4442 (lines=14) @@
|
| 4426 |
|
|
| 4427 |
|
// Legacy search engine does have scoring, sorting the results by ID in that case |
| 4428 |
|
$setupFactory = $this->getSetupFactory(); |
| 4429 |
|
if (get_class($setupFactory) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') { |
| 4430 |
|
usort( |
| 4431 |
|
$searchHits, |
| 4432 |
|
function ($a, $b) { |
| 4433 |
|
return ($a->valueObject->id < $b->valueObject->id) ? -1 : 1; |
| 4434 |
|
} |
| 4435 |
|
); |
| 4436 |
|
|
| 4437 |
|
$this->assertEquals($content1->id, $searchHits[0]->valueObject->id); |
| 4438 |
|
$this->assertEquals($content2->id, $searchHits[1]->valueObject->id); |
| 4439 |
|
$this->assertEquals($content3->id, $searchHits[2]->valueObject->id); |
| 4440 |
|
|
| 4441 |
|
return; |
| 4442 |
|
} |
| 4443 |
|
|
| 4444 |
|
// Assert scores are descending |
| 4445 |
|
$this->assertGreaterThan($searchHits[1]->score, $searchHits[0]->score); |
|
@@ 4486-4499 (lines=14) @@
|
| 4483 |
|
|
| 4484 |
|
// Legacy search engine does have scoring, sorting the results by ID in that case |
| 4485 |
|
$setupFactory = $this->getSetupFactory(); |
| 4486 |
|
if (get_class($setupFactory) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') { |
| 4487 |
|
usort( |
| 4488 |
|
$searchHits, |
| 4489 |
|
function ($a, $b) { |
| 4490 |
|
return ($a->valueObject->id < $b->valueObject->id) ? -1 : 1; |
| 4491 |
|
} |
| 4492 |
|
); |
| 4493 |
|
|
| 4494 |
|
$this->assertEquals($content1->id, $searchHits[0]->valueObject->contentId); |
| 4495 |
|
$this->assertEquals($content2->id, $searchHits[1]->valueObject->contentId); |
| 4496 |
|
$this->assertEquals($content3->id, $searchHits[2]->valueObject->contentId); |
| 4497 |
|
|
| 4498 |
|
return; |
| 4499 |
|
} |
| 4500 |
|
|
| 4501 |
|
// Assert scores are descending |
| 4502 |
|
$this->assertGreaterThan($searchHits[1]->score, $searchHits[0]->score); |