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