|
@@ 616-626 (lines=11) @@
|
| 613 |
|
} |
| 614 |
|
|
| 615 |
|
|
| 616 |
|
public function testSearchFieldsMappingForClasses() { |
| 617 |
|
$qg = new QueryGenerator(); |
| 618 |
|
$qg->setClasses('FlickrPhotoTO,Page'); |
| 619 |
|
$fields = array('Title' => 2, 'Description' => 1); |
| 620 |
|
$expected = array('Title^2', 'Title.*^2','Description', 'Description.*'); |
| 621 |
|
$this->assertEquals($expected, $qg->convertWeightedFieldsForElastica($fields)); |
| 622 |
|
|
| 623 |
|
$qg->setClasses(array('FlickrPhotoTO','Page')); |
| 624 |
|
$this->assertEquals($expected, $qg->convertWeightedFieldsForElastica($fields)); |
| 625 |
|
|
| 626 |
|
} |
| 627 |
|
|
| 628 |
|
|
| 629 |
|
public function testSearchFieldsMappingForClassesCaching() { |
|
@@ 652-663 (lines=12) @@
|
| 649 |
|
} |
| 650 |
|
|
| 651 |
|
|
| 652 |
|
public function testSearchFieldsMappingForSiteTree() { |
| 653 |
|
$qg = new QueryGenerator(); |
| 654 |
|
$qg->setClasses(null); // select all of site tree classes |
| 655 |
|
$fields = array('Title' => 2, 'Content' => 1); |
| 656 |
|
$expected = array('Title^2', 'Title.*^2','Content', 'Content.*'); |
| 657 |
|
$this->assertEquals($expected, $qg->convertWeightedFieldsForElastica($fields)); |
| 658 |
|
|
| 659 |
|
echo "--------------------\n"; |
| 660 |
|
$qg->setClasses(array('FlickrPhotoTO','Page')); |
| 661 |
|
$this->assertEquals($expected, $qg->convertWeightedFieldsForElastica($fields)); |
| 662 |
|
|
| 663 |
|
} |
| 664 |
|
|
| 665 |
|
|
| 666 |
|
public function testPagination() { |