| @@ 13-34 (lines=22) @@ | ||
| 10 | public static $fixture_file = 'elastica/tests/lotsOfPhotos.yml'; |
|
| 11 | ||
| 12 | ||
| 13 | public function setup() { |
|
| 14 | parent::setup(); |
|
| 15 | $config = Config::inst()->get('FlickrPhotoTO', 'searchable_fields'); |
|
| 16 | ||
| 17 | \Config::inst()->update('FlickrPhotoTO', 'searchable_autocomplete', array('Title')); |
|
| 18 | ||
| 19 | ||
| 20 | // Delete and assert that it does not exist |
|
| 21 | $sql = "SELECT ID,Name,ClazzName from SearchableField"; |
|
| 22 | $records = DB::query($sql); |
|
| 23 | ||
| 24 | $filter = array('Name' => 'Title', 'ClazzName' => 'FlickrPhotoTO'); |
|
| 25 | $sf = SearchableField::get()->filter($filter)->first(); |
|
| 26 | $sql = "UPDATE ElasticSearchPage_ElasticaSearchableFields SET Searchable=1,". |
|
| 27 | "EnableAutocomplete=1 where SearchableFieldID=".$sf->ID; |
|
| 28 | ||
| 29 | DB::query($sql); |
|
| 30 | ||
| 31 | $task = new ReindexTask($this->service); |
|
| 32 | // null request is fine as no parameters used |
|
| 33 | $task->run(null); |
|
| 34 | } |
|
| 35 | ||
| 36 | ||
| 37 | ||
| @@ 13-34 (lines=22) @@ | ||
| 10 | public static $fixture_file = 'elastica/tests/autocomplete.yml'; |
|
| 11 | ||
| 12 | ||
| 13 | public function setupNOT() { |
|
| 14 | parent::setup(); |
|
| 15 | $config = Config::inst()->get('FlickrPhotoTO', 'searchable_fields'); |
|
| 16 | ||
| 17 | \Config::inst()->update('FlickrPhotoTO', 'searchable_autocomplete', array('Title')); |
|
| 18 | ||
| 19 | ||
| 20 | // Delete and assert that it does not exist |
|
| 21 | $sql = "SELECT ID,Name,ClazzName from SearchableField"; |
|
| 22 | $records = DB::query($sql); |
|
| 23 | ||
| 24 | $filter = array('Name' => 'Title', 'ClazzName' => 'FlickrPhotoTO'); |
|
| 25 | $sf = SearchableField::get()->filter($filter)->first(); |
|
| 26 | $sql = "UPDATE ElasticSearchPage_ElasticaSearchableFields SET Searchable=1,". |
|
| 27 | "EnableAutocomplete=1 where SearchableFieldID=".$sf->ID; |
|
| 28 | ||
| 29 | DB::query($sql); |
|
| 30 | ||
| 31 | $task = new ReindexTask($this->service); |
|
| 32 | // null request is fine as no parameters used |
|
| 33 | $task->run(null); |
|
| 34 | } |
|
| 35 | ||
| 36 | ||
| 37 | public function testSiteTree() { |
|