| @@ 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); |
|
| @@ 935-944 (lines=10) @@ | ||
| 932 | /* |
|
| 933 | ResultList and ElasticSearcher both have accessors to the aggregates. Check they are the same |
|
| 934 | */ |
|
| 935 | public function testGetAggregations() { |
|
| 936 | $es = new ElasticSearcher(); |
|
| 937 | $es->setStart(0); |
|
| 938 | $es->setPageLength(10); |
|
| 939 | //$es->addFilter('IsInSiteTree', false); |
|
| 940 | $es->setClasses('FlickrPhotoTO'); |
|
| 941 | $es->setQueryResultManipulator('FlickrPhotoTOElasticaSearchHelper'); |
|
| 942 | $resultList = $es->search('New Zealand'); |
|
| 943 | $this->assertEquals($resultList->getAggregations(), $es->getAggregations()); |
|
| 944 | } |
|
| 945 | ||
| 946 | ||
| 947 | public function testAggregationNonExistentField() { |
|