| @@ 924-933 (lines=10) @@ | ||
| 921 | /* |
|
| 922 | ResultList and ElasticSearcher both have accessors to the aggregates. Check they are the same |
|
| 923 | */ |
|
| 924 | public function testGetAggregations() { |
|
| 925 | $es = new ElasticSearcher(); |
|
| 926 | $es->setStart(0); |
|
| 927 | $es->setPageLength(10); |
|
| 928 | //$es->addFilter('IsInSiteTree', false); |
|
| 929 | $es->setClasses('FlickrPhotoTO'); |
|
| 930 | $es->setQueryResultManipulator('FlickrPhotoTOElasticaSearchHelper'); |
|
| 931 | $resultList = $es->search('New Zealand'); |
|
| 932 | $this->assertEquals($resultList->getAggregations(), $es->getAggregations()); |
|
| 933 | } |
|
| 934 | ||
| 935 | ||
| 936 | public function testAggregationNonExistentField() { |
|
| @@ 434-444 (lines=11) @@ | ||
| 431 | * Test searching |
|
| 432 | * http://stackoverflow.com/questions/28305250/elasticsearch-customize-score-for-synonyms-stemming |
|
| 433 | */ |
|
| 434 | private function search($query, $resultsExpected = 10, $fields = null) { |
|
| 435 | $es = new ElasticSearcher(); |
|
| 436 | $es->setStart(0); |
|
| 437 | $es->setPageLength(100); |
|
| 438 | $es->setClasses('FlickrPhotoTO'); |
|
| 439 | $results = $es->search($query, $fields); |
|
| 440 | $this->assertEquals($resultsExpected, $results->count()); |
|
| 441 | return $results->count(); |
|
| 442 | } |
|
| 443 | ||
| 444 | ||
| 445 | private function getResultsFor($query, $pageLength = 10, $fields = array('Title' => 1, 'Description' => 1)) { |
|
| 446 | $es = new ElasticSearcher(); |
|
| 447 | $es->setStart(0); |
|