| @@ 65-75 (lines=11) @@ | ||
| 62 | } |
|
| 63 | ||
| 64 | ||
| 65 | public function testAutoCompleteGood() { |
|
| 66 | $es = new ElasticSearcher(); |
|
| 67 | $es->setClasses('FlickrPhotoTO'); |
|
| 68 | $fields = array('Title' => 1, 'Description' => 1); |
|
| 69 | $query = 'Lond'; |
|
| 70 | $results = $es->autocomplete_search($query, 'Title'); |
|
| 71 | $this->assertEquals(7, $results->getTotalItems()); |
|
| 72 | foreach ($results->toArray() as $result) { |
|
| 73 | $this->assertTrue(strpos($result->Title, $query) > 0); |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| 77 | ||
| 78 | ||
| @@ 263-273 (lines=11) @@ | ||
| 260 | } |
|
| 261 | ||
| 262 | ||
| 263 | public function testAutoCompleteGood() { |
|
| 264 | $es = new ElasticSearcher(); |
|
| 265 | $es->setClasses('FlickrPhotoTO'); |
|
| 266 | $fields = array('Title' => 1, 'Description' => 1); |
|
| 267 | $query = 'Lond'; |
|
| 268 | $results = $es->autocomplete_search($query, 'Title'); |
|
| 269 | $this->assertEquals(7, $results->getTotalItems()); |
|
| 270 | foreach ($results->toArray() as $result) { |
|
| 271 | $this->assertTrue(strpos($result->Title, $query) > 0); |
|
| 272 | } |
|
| 273 | } |
|
| 274 | ||
| 275 | ||
| 276 | private function makeCode($paginated) { |
|