|
@@ 4467-4480 (lines=14) @@
|
| 4464 |
|
|
| 4465 |
|
// Legacy search engine does have scoring, sorting the results by ID in that case |
| 4466 |
|
$setupFactory = $this->getSetupFactory(); |
| 4467 |
|
if (get_class($setupFactory) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') { |
| 4468 |
|
usort( |
| 4469 |
|
$searchHits, |
| 4470 |
|
function ($a, $b) { |
| 4471 |
|
return ($a->valueObject->id < $b->valueObject->id) ? -1 : 1; |
| 4472 |
|
} |
| 4473 |
|
); |
| 4474 |
|
|
| 4475 |
|
$this->assertEquals($content1->id, $searchHits[0]->valueObject->id); |
| 4476 |
|
$this->assertEquals($content2->id, $searchHits[1]->valueObject->id); |
| 4477 |
|
$this->assertEquals($content3->id, $searchHits[2]->valueObject->id); |
| 4478 |
|
|
| 4479 |
|
return; |
| 4480 |
|
} |
| 4481 |
|
|
| 4482 |
|
// Assert scores are descending |
| 4483 |
|
$this->assertGreaterThan($searchHits[1]->score, $searchHits[0]->score); |
|
@@ 4528-4541 (lines=14) @@
|
| 4525 |
|
|
| 4526 |
|
// Legacy search engine does have scoring, sorting the results by ID in that case |
| 4527 |
|
$setupFactory = $this->getSetupFactory(); |
| 4528 |
|
if (get_class($setupFactory) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') { |
| 4529 |
|
usort( |
| 4530 |
|
$searchHits, |
| 4531 |
|
function ($a, $b) { |
| 4532 |
|
return ($a->valueObject->id < $b->valueObject->id) ? -1 : 1; |
| 4533 |
|
} |
| 4534 |
|
); |
| 4535 |
|
|
| 4536 |
|
$this->assertEquals($content1->id, $searchHits[0]->valueObject->contentId); |
| 4537 |
|
$this->assertEquals($content2->id, $searchHits[1]->valueObject->contentId); |
| 4538 |
|
$this->assertEquals($content3->id, $searchHits[2]->valueObject->contentId); |
| 4539 |
|
|
| 4540 |
|
return; |
| 4541 |
|
} |
| 4542 |
|
|
| 4543 |
|
// Assert scores are descending |
| 4544 |
|
$this->assertGreaterThan($searchHits[1]->score, $searchHits[0]->score); |