|
@@ 630-640 (lines=11) @@
|
| 627 |
|
} |
| 628 |
|
|
| 629 |
|
|
| 630 |
|
public function testSearchFieldsMappingForClasses() { |
| 631 |
|
$qg = new QueryGenerator(); |
| 632 |
|
$qg->setClasses('FlickrPhotoTO,Page'); |
| 633 |
|
$fields = array('Title' => 2, 'Description' => 1); |
| 634 |
|
$expected = array('Title^2', 'Title.*^2','Description', 'Description.*'); |
| 635 |
|
$this->assertEquals($expected, $qg->convertWeightedFieldsForElastica($fields)); |
| 636 |
|
|
| 637 |
|
$qg->setClasses(array('FlickrPhotoTO','Page')); |
| 638 |
|
$this->assertEquals($expected, $qg->convertWeightedFieldsForElastica($fields)); |
| 639 |
|
|
| 640 |
|
} |
| 641 |
|
|
| 642 |
|
|
| 643 |
|
public function testSearchFieldsMappingForClassesCaching() { |
|
@@ 666-677 (lines=12) @@
|
| 663 |
|
} |
| 664 |
|
|
| 665 |
|
|
| 666 |
|
public function testSearchFieldsMappingForSiteTree() { |
| 667 |
|
$qg = new QueryGenerator(); |
| 668 |
|
$qg->setClasses(null); // select all of site tree classes |
| 669 |
|
$fields = array('Title' => 2, 'Content' => 1); |
| 670 |
|
$expected = array('Title^2', 'Title.*^2','Content', 'Content.*'); |
| 671 |
|
$this->assertEquals($expected, $qg->convertWeightedFieldsForElastica($fields)); |
| 672 |
|
|
| 673 |
|
echo "--------------------\n"; |
| 674 |
|
$qg->setClasses(array('FlickrPhotoTO','Page')); |
| 675 |
|
$this->assertEquals($expected, $qg->convertWeightedFieldsForElastica($fields)); |
| 676 |
|
|
| 677 |
|
} |
| 678 |
|
|
| 679 |
|
|
| 680 |
|
public function testPagination() { |