@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | //return false; |
| 23 | 23 | // |
| 24 | 24 | |
| 25 | - if ($data['ClassesToSearch'] == array()) { |
|
| 25 | + if($data['ClassesToSearch'] == array()) { |
|
| 26 | 26 | $data['ClassesToSearch'] = ''; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | echo "STDATA:$debug\n"; |
| 31 | 31 | |
| 32 | 32 | // Check if any classes to search if site tree only is not ticked |
| 33 | - if (!$data['SiteTreeOnly']) { |
|
| 34 | - if (!$data['ClassesToSearch']) { |
|
| 33 | + if(!$data['SiteTreeOnly']) { |
|
| 34 | + if(!$data['ClassesToSearch']) { |
|
| 35 | 35 | $valid = false; |
| 36 | 36 | $this->validationError("ClassesToSearch", |
| 37 | 37 | "Please provide at least one class to search, or select 'Site Tree Only'", |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | ); |
| 40 | 40 | } else { |
| 41 | 41 | $toSearch = $data['ClassesToSearch']; |
| 42 | - foreach ($toSearch as $clazz) { |
|
| 42 | + foreach($toSearch as $clazz) { |
|
| 43 | 43 | try { |
| 44 | 44 | $instance = Injector::inst()->create($clazz); |
| 45 | - if (!$instance->hasExtension('SilverStripe\Elastica\Searchable')) { |
|
| 46 | - $this->validationError('ClassesToSearch', 'The class '.$clazz.' must have the Searchable extension'); |
|
| 45 | + if(!$instance->hasExtension('SilverStripe\Elastica\Searchable')) { |
|
| 46 | + $this->validationError('ClassesToSearch', 'The class ' . $clazz . ' must have the Searchable extension'); |
|
| 47 | 47 | } |
| 48 | 48 | } catch (ReflectionException $e) { |
| 49 | 49 | $this->validationError("ClassesToSearch", |
| 50 | - 'The class '.$clazz.' does not exist', |
|
| 50 | + 'The class ' . $clazz . ' does not exist', |
|
| 51 | 51 | 'error' |
| 52 | 52 | ); |
| 53 | 53 | } |
@@ -58,23 +58,23 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | // Check the identifier is unique |
| 60 | 60 | $mode = Versioned::get_reading_mode(); |
| 61 | - $suffix = ''; |
|
| 62 | - if ($mode == 'Stage.Live') { |
|
| 61 | + $suffix = ''; |
|
| 62 | + if($mode == 'Stage.Live') { |
|
| 63 | 63 | $suffix = '_Live'; |
| 64 | 64 | } |
| 65 | - $where = 'ElasticSearchPage'.$suffix.'.ID != '.$data['ID']." AND `Identifier` = '".$data['Identifier']."'"; |
|
| 65 | + $where = 'ElasticSearchPage' . $suffix . '.ID != ' . $data['ID'] . " AND `Identifier` = '" . $data['Identifier'] . "'"; |
|
| 66 | 66 | $existing = ElasticSearchPage::get()->where($where)->count(); |
| 67 | - if ($existing > 0) { |
|
| 67 | + if($existing > 0) { |
|
| 68 | 68 | $valid = false; |
| 69 | 69 | $this->validationError('Identifier', |
| 70 | - 'The identifier '.$data['Identifier'].' already exists', |
|
| 70 | + 'The identifier ' . $data['Identifier'] . ' already exists', |
|
| 71 | 71 | 'error' |
| 72 | 72 | ); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | // Check number of results per page >= 1 |
| 77 | - if ($data['ResultsPerPage'] <= 0) { |
|
| 77 | + if($data['ResultsPerPage'] <= 0) { |
|
| 78 | 78 | $valid = false; |
| 79 | 79 | $this->validationError('ResultsPerPage', |
| 80 | 80 | 'Results per page must be >=1' |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $searchPage = $this->getSearchPage($identifier); |
| 14 | 14 | |
| 15 | - if ($searchPage) { |
|
| 15 | + if($searchPage) { |
|
| 16 | 16 | $result = $searchPage->AbsoluteLink(); |
| 17 | 17 | } |
| 18 | 18 | return $result; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | $searchPage = $this->getSearchPage($identifier); |
| 26 | 26 | |
| 27 | - if ($searchPage) { |
|
| 27 | + if($searchPage) { |
|
| 28 | 28 | $result = $searchPage->SearchForm($buttonTextOverride); |
| 29 | 29 | } |
| 30 | 30 | return $result; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | public function getSearchPage($identifier) { |
| 35 | - if (!isset($this->_CachedLastEdited)) { |
|
| 35 | + if(!isset($this->_CachedLastEdited)) { |
|
| 36 | 36 | $this->_CachedLastEdited = ElasticSearchPage::get()->max('LastEdited'); |
| 37 | 37 | } |
| 38 | 38 | $ck = $this->_CachedLastEdited; |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $cache = SS_Cache::factory('searchpagecache'); |
| 44 | 44 | $searchPage = null; |
| 45 | - $cachekeyname = 'searchpageuri'.$identifier.$this->owner->Locale.$ck; |
|
| 45 | + $cachekeyname = 'searchpageuri' . $identifier . $this->owner->Locale . $ck; |
|
| 46 | 46 | |
| 47 | 47 | if(!($searchPage = unserialize($cache->load($cachekeyname)))) { |
| 48 | - $searchPage = ElasticSearchPage::get()->filter('Identifier',$identifier)->first(); |
|
| 48 | + $searchPage = ElasticSearchPage::get()->filter('Identifier', $identifier)->first(); |
|
| 49 | 49 | $cache->save(serialize($searchPage), $cachekeyname); |
| 50 | 50 | } |
| 51 | 51 | return $searchPage; |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | public function run($request) { |
| 30 | - $message = function ($content) { |
|
| 30 | + $message = function($content) { |
|
| 31 | 31 | print(\Director::is_cli() ? "$content\n" : "<p>$content</p>"); |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | 34 | $locales = array(); |
| 35 | 35 | if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable')) { |
| 36 | - foreach (\Translatable::get_existing_content_languages('SiteTree') as $code => $val) { |
|
| 36 | + foreach(\Translatable::get_existing_content_languages('SiteTree') as $code => $val) { |
|
| 37 | 37 | array_push($locales, $code); |
| 38 | 38 | } |
| 39 | 39 | } else { |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // now iterate all the locales indexing each locale in turn using it's owner index settings |
| 44 | - foreach ($locales as $locale) { |
|
| 44 | + foreach($locales as $locale) { |
|
| 45 | 45 | Searchable::$index_ctr = 0; |
| 46 | - $message('Indexing locale '.$locale); |
|
| 46 | + $message('Indexing locale ' . $locale); |
|
| 47 | 47 | |
| 48 | - if (class_exists('Translatable')) { |
|
| 48 | + if(class_exists('Translatable')) { |
|
| 49 | 49 | \Translatable::set_current_locale($locale); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | $this->service->refresh(); |
| 63 | 63 | // display indexing speed stats |
| 64 | 64 | $endTime = microtime(true); |
| 65 | - $elapsed = $endTime-$startTime; |
|
| 65 | + $elapsed = $endTime - $startTime; |
|
| 66 | 66 | $perSecond = Searchable::$index_ctr / $elapsed; |
| 67 | - $info = "\nReindexing $locale completed \n ".Searchable::$index_ctr." docs in ".round($elapsed,2)." seconds "; |
|
| 68 | - $info .= "at ".round($perSecond,2)." documents per second\n\n"; |
|
| 67 | + $info = "\nReindexing $locale completed \n " . Searchable::$index_ctr . " docs in " . round($elapsed, 2) . " seconds "; |
|
| 68 | + $info .= "at " . round($perSecond, 2) . " documents per second\n\n"; |
|
| 69 | 69 | $message($info); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function run($request) { |
| 24 | - $message = function ($content) { |
|
| 24 | + $message = function($content) { |
|
| 25 | 25 | print(\Director::is_cli() ? "$content\n" : "<p>$content</p>"); |
| 26 | 26 | }; |
| 27 | 27 | |
| 28 | 28 | $locales = array(); |
| 29 | 29 | |
| 30 | - if ($this->locale == null) { |
|
| 31 | - if (class_exists('Translatable') && \SiteTree::has_extension('Translatable')) { |
|
| 30 | + if($this->locale == null) { |
|
| 31 | + if(class_exists('Translatable') && \SiteTree::has_extension('Translatable')) { |
|
| 32 | 32 | $this->locale = \Translatable::get_current_locale(); |
| 33 | 33 | } else { |
| 34 | - foreach (\Translatable::get_existing_content_languages('SiteTree') as $code => $val) { |
|
| 34 | + foreach(\Translatable::get_existing_content_languages('SiteTree') as $code => $val) { |
|
| 35 | 35 | array_push($locales, $code); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | $es->setPageLength(20); |
| 45 | 45 | $es->addFilter('IsInSiteTree', true); |
| 46 | 46 | $results = $es->search($query); |
| 47 | - foreach ($results as $result) { |
|
| 48 | - $title = '['.$result->ClassName.', '.$result->ID.'] '; |
|
| 47 | + foreach($results as $result) { |
|
| 48 | + $title = '[' . $result->ClassName . ', ' . $result->ID . '] '; |
|
| 49 | 49 | $title .= $result->Title; |
| 50 | 50 | $message($title); |
| 51 | - if ($result->SearchHighlightsByField->Content) { |
|
| 52 | - foreach ($result->SearchHighlightsByField->Content as $highlight) { |
|
| 53 | - $message("- ".$highlight->Snippet); |
|
| 51 | + if($result->SearchHighlightsByField->Content) { |
|
| 52 | + foreach($result->SearchHighlightsByField->Content as $highlight) { |
|
| 53 | + $message("- " . $highlight->Snippet); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | // Delete and assert that it does not exist |
| 23 | 23 | echo "Displaying searchable fields\n"; |
| 24 | - $sql = "SELECT ID,Name,ClazzName from SearchableField"; |
|
| 24 | + $sql = "SELECT ID,Name,ClazzName from SearchableField"; |
|
| 25 | 25 | $records = DB::query($sql); |
| 26 | - foreach ($records as $record) { |
|
| 26 | + foreach($records as $record) { |
|
| 27 | 27 | print_r($record); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $filter = array('Name' => 'Title', 'ClazzName' => 'FlickrPhotoTO'); |
| 31 | 31 | $sf = SearchableField::get()->filter($filter)->first(); |
| 32 | 32 | print_r($sf); |
| 33 | - $sql = "UPDATE ElasticSearchPage_ElasticaSearchableFields SET Searchable=1,". |
|
| 34 | - "EnableAutocomplete=1 where SearchableFieldID=".$sf->ID; |
|
| 33 | + $sql = "UPDATE ElasticSearchPage_ElasticaSearchableFields SET Searchable=1," . |
|
| 34 | + "EnableAutocomplete=1 where SearchableFieldID=" . $sf->ID; |
|
| 35 | 35 | echo $sql; |
| 36 | 36 | |
| 37 | 37 | DB::query($sql); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $this->assertEquals('the', $result->Query); |
| 58 | 58 | $lquery = strtolower($result->Query); |
| 59 | - foreach ($result->suggestions as $suggestion) { |
|
| 59 | + foreach($result->suggestions as $suggestion) { |
|
| 60 | 60 | $value = $suggestion->value; |
| 61 | 61 | $value = strtolower($value); |
| 62 | 62 | $this->assertContains($lquery, $value); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $this->assertEquals('the', $result->Query); |
| 112 | 112 | $lquery = strtolower($result->Query); |
| 113 | - foreach ($result->suggestions as $suggestion) { |
|
| 113 | + foreach($result->suggestions as $suggestion) { |
|
| 114 | 114 | $value = $suggestion->value; |
| 115 | 115 | $value = strtolower($value); |
| 116 | 116 | $this->assertContains($lquery, $value); |
@@ -13,15 +13,15 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | $fields = $searchPage->getCMSFields(); |
| 15 | 15 | |
| 16 | - $mainTab = $this->checkTabExists($fields,'Main'); |
|
| 16 | + $mainTab = $this->checkTabExists($fields, 'Main'); |
|
| 17 | 17 | $this->checkFieldExists($mainTab, 'Identifier'); |
| 18 | 18 | $this->checkFieldExists($mainTab, 'ContentForEmptySearch'); |
| 19 | 19 | |
| 20 | - $searchTab = $this->checkTabExists($fields,'Search.SearchFor'); |
|
| 21 | - $fieldsTab = $this->checkTabExists($fields,'Search.Fields'); |
|
| 22 | - $autoCompleteTab = $this->checkTabExists($fields,'Search.AutoComplete'); |
|
| 23 | - $aggTab = $this->checkTabExists($fields,'Search.Aggregations'); |
|
| 24 | - $simTab = $this->checkTabExists($fields,'Search.Similarity'); |
|
| 20 | + $searchTab = $this->checkTabExists($fields, 'Search.SearchFor'); |
|
| 21 | + $fieldsTab = $this->checkTabExists($fields, 'Search.Fields'); |
|
| 22 | + $autoCompleteTab = $this->checkTabExists($fields, 'Search.AutoComplete'); |
|
| 23 | + $aggTab = $this->checkTabExists($fields, 'Search.Aggregations'); |
|
| 24 | + $simTab = $this->checkTabExists($fields, 'Search.Similarity'); |
|
| 25 | 25 | |
| 26 | 26 | $this->checkFieldExists($searchTab, 'InfoField'); |
| 27 | 27 | $this->checkFieldExists($searchTab, 'SiteTreeOnly'); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $tab = $fields->findOrMakeTab("Root.Search.Fields"); |
| 50 | 50 | $fieldsTab = $tab->Fields(); |
| 51 | 51 | |
| 52 | - foreach ($fieldsTab as $field) { |
|
| 52 | + foreach($fieldsTab as $field) { |
|
| 53 | 53 | echo "FIELD:{$field->getName()}\n"; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $gridDetailForm = $pickerConfig->getComponentByType('GridFieldDetailForm'); |
| 59 | 59 | |
| 60 | 60 | echo "SEARCHABLE FIELDS\n"; |
| 61 | - foreach ($searchPage->ElasticaSearchableFields()->getIterator() as $sf) { |
|
| 61 | + foreach($searchPage->ElasticaSearchableFields()->getIterator() as $sf) { |
|
| 62 | 62 | echo "SEARCHABLE FIELD {$sf->ClazzName},{$sf->Name}!\n"; |
| 63 | 63 | |
| 64 | 64 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $pageLength = 10; // the default |
| 186 | 186 | $searchPageObj->ResultsPerPage = $pageLength; |
| 187 | 187 | $searchPageObj->write(); |
| 188 | - $searchPageObj->publish('Stage','Live'); |
|
| 188 | + $searchPageObj->publish('Stage', 'Live'); |
|
| 189 | 189 | |
| 190 | 190 | $form = $searchPageObj->SearchForm(); |
| 191 | 191 | $fields = $form->Fields(); |
@@ -317,11 +317,11 @@ discard block |
||
| 317 | 317 | $filter = array('ClazzName' => 'FlickrPhotoTO', 'Name' => 'Title'); |
| 318 | 318 | |
| 319 | 319 | //Check fieldnames as expected |
| 320 | - $searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active',1); |
|
| 320 | + $searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active', 1); |
|
| 321 | 321 | $sfs = $searchableFields->map('Name')->toArray(); |
| 322 | 322 | sort($sfs); |
| 323 | - $expected = array('Aperture','AspectRatio','Description','FirstViewed','FlickrID', |
|
| 324 | - 'FlickrSetTOs','FlickrTagTOs','FocalLength35mm','ISO','Photographer','ShutterSpeed', |
|
| 323 | + $expected = array('Aperture', 'AspectRatio', 'Description', 'FirstViewed', 'FlickrID', |
|
| 324 | + 'FlickrSetTOs', 'FlickrTagTOs', 'FocalLength35mm', 'ISO', 'Photographer', 'ShutterSpeed', |
|
| 325 | 325 | 'TakenAt', 'TakenAtDT', 'TestMethod', 'TestMethodHTML', 'Title'); |
| 326 | 326 | $this->assertEquals($expected, $sfs); |
| 327 | 327 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $searchPage->Title = '**** SiteTree Search ****'; |
| 332 | 332 | $searchPage->write(); |
| 333 | 333 | |
| 334 | - $searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active',1); |
|
| 334 | + $searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active', 1); |
|
| 335 | 335 | $sfs = $searchableFields->map('Name')->toArray(); |
| 336 | 336 | sort($sfs); |
| 337 | 337 | $expected = array('Content', 'Country', 'PageDate', 'Title'); |
@@ -351,15 +351,15 @@ discard block |
||
| 351 | 351 | // expected mapping of searchable classes to searchable fields that will be |
| 352 | 352 | // stored in the database as SearchableClass and SearchableField |
| 353 | 353 | $expected = array( |
| 354 | - 'Page' => array('Title','Content'), |
|
| 355 | - 'SiteTree' => array('Title','Content'), |
|
| 356 | - 'SearchableTestPage' => array('Title','Content','Country','PageDate'), |
|
| 354 | + 'Page' => array('Title', 'Content'), |
|
| 355 | + 'SiteTree' => array('Title', 'Content'), |
|
| 356 | + 'SearchableTestPage' => array('Title', 'Content', 'Country', 'PageDate'), |
|
| 357 | 357 | 'FlickrTagTO' => array('RawValue'), |
| 358 | - 'FlickrAuthorTO' => array('PathAlias','DisplayName','FlickrPhotoTOs'), |
|
| 359 | - 'FlickrPhotoTO' => array('Title','FlickrID','Description','TakenAt', 'TakenAtDT', 'Aperture', |
|
| 360 | - 'ShutterSpeed','FocalLength35mm','ISO','Photographer','FlickrTagTOs','FlickrSetTOs', |
|
| 361 | - 'FirstViewed','AspectRatio', 'TestMethod', 'TestMethodHTML'), |
|
| 362 | - 'FlickrSetTO' => array('Title','FlickrID','Description') |
|
| 358 | + 'FlickrAuthorTO' => array('PathAlias', 'DisplayName', 'FlickrPhotoTOs'), |
|
| 359 | + 'FlickrPhotoTO' => array('Title', 'FlickrID', 'Description', 'TakenAt', 'TakenAtDT', 'Aperture', |
|
| 360 | + 'ShutterSpeed', 'FocalLength35mm', 'ISO', 'Photographer', 'FlickrTagTOs', 'FlickrSetTOs', |
|
| 361 | + 'FirstViewed', 'AspectRatio', 'TestMethod', 'TestMethodHTML'), |
|
| 362 | + 'FlickrSetTO' => array('Title', 'FlickrID', 'Description') |
|
| 363 | 363 | ); |
| 364 | 364 | |
| 365 | 365 | // check the expected classes |
@@ -380,21 +380,21 @@ discard block |
||
| 380 | 380 | // check the names expected to appear |
| 381 | 381 | |
| 382 | 382 | $fieldCtr = 0; |
| 383 | - foreach ($expectedClasses as $expectedClass) { |
|
| 383 | + foreach($expectedClasses as $expectedClass) { |
|
| 384 | 384 | $expectedFields = array(); |
| 385 | 385 | $sc = SearchableClass::get()->filter('Name', $expectedClass)->first(); |
| 386 | - $this->assertEquals($expectedClass,$sc->Name); |
|
| 386 | + $this->assertEquals($expectedClass, $sc->Name); |
|
| 387 | 387 | |
| 388 | 388 | $inSiteTree = 1; |
| 389 | - $start = substr($expectedClass, 0,6); |
|
| 390 | - if ($start == 'Flickr') { |
|
| 389 | + $start = substr($expectedClass, 0, 6); |
|
| 390 | + if($start == 'Flickr') { |
|
| 391 | 391 | $inSiteTree = 0; |
| 392 | 392 | }; |
| 393 | - $this->assertEquals($inSiteTree,$sc->InSiteTree); |
|
| 393 | + $this->assertEquals($inSiteTree, $sc->InSiteTree); |
|
| 394 | 394 | |
| 395 | 395 | $expectedNames = $expected[$expectedClass]; |
| 396 | - foreach ($expectedNames as $expectedName) { |
|
| 397 | - $filter = array('Name' => $expectedName, 'SearchableClassID' => $sc->ID ); |
|
| 396 | + foreach($expectedNames as $expectedName) { |
|
| 397 | + $filter = array('Name' => $expectedName, 'SearchableClassID' => $sc->ID); |
|
| 398 | 398 | $sf = SearchableField::get()->filter($filter)->first(); |
| 399 | 399 | $this->assertEquals($expectedName, $sf->Name); |
| 400 | 400 | $fieldCtr++; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $expected = array('first'); |
| 27 | 27 | $this->assertEquals($expected, array_keys($terms['Title.standard']['terms'])); |
| 28 | 28 | |
| 29 | - $expected = array('fi','fir','firs','first','ir','irs','irst','rs','rst','st'); |
|
| 29 | + $expected = array('fi', 'fir', 'firs', 'first', 'ir', 'irs', 'irst', 'rs', 'rst', 'st'); |
|
| 30 | 30 | $this->assertEquals($expected, array_keys($terms['Title.autocomplete']['terms'])); |
| 31 | 31 | |
| 32 | 32 | // ---- now a parental class page ---- |
@@ -60,20 +60,20 @@ discard block |
||
| 60 | 60 | $terms = $page->getTermVectors(); |
| 61 | 61 | |
| 62 | 62 | //Check the expected fields are indexed |
| 63 | - $expected = array('Content','Content.shingles','Content.standard','FatherText','FatherText.shingles','FatherText.standard', |
|
| 64 | - 'GrandFatherText','GrandFatherText.shingles','GrandFatherText.standard','Link','Title','Title.autocomplete', |
|
| 65 | - 'Title.shingles','Title.standard'); |
|
| 63 | + $expected = array('Content', 'Content.shingles', 'Content.standard', 'FatherText', 'FatherText.shingles', 'FatherText.standard', |
|
| 64 | + 'GrandFatherText', 'GrandFatherText.shingles', 'GrandFatherText.standard', 'Link', 'Title', 'Title.autocomplete', |
|
| 65 | + 'Title.shingles', 'Title.standard'); |
|
| 66 | 66 | $indexedFields = array_keys($terms); |
| 67 | 67 | sort($indexedFields); |
| 68 | - foreach ($indexedFields as $field) { |
|
| 69 | - echo "'".$field."',"; |
|
| 68 | + foreach($indexedFields as $field) { |
|
| 69 | + echo "'" . $field . "',"; |
|
| 70 | 70 | } |
| 71 | 71 | $this->assertEquals($expected, $indexedFields); |
| 72 | 72 | |
| 73 | 73 | $fatherTerms = $terms['FatherText.standard']['terms']; |
| 74 | 74 | $grandFatherTerms = $terms['GrandFatherText.standard']['terms']; |
| 75 | 75 | |
| 76 | - $expected = array('father', 'field', 'grandfather', 'page', 'trace3');; |
|
| 76 | + $expected = array('father', 'field', 'grandfather', 'page', 'trace3'); ; |
|
| 77 | 77 | $this->assertEquals($expected, array_keys($fatherTerms)); |
| 78 | 78 | |
| 79 | 79 | $expected = array('grandfather', 'page', 'trace4'); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | $fields = $sf->getCMSFields(); |
| 17 | 17 | |
| 18 | - $tab = $this->checkTabExists($fields,'Main'); |
|
| 18 | + $tab = $this->checkTabExists($fields, 'Main'); |
|
| 19 | 19 | |
| 20 | 20 | //Check fields |
| 21 | 21 | $nf = $this->checkFieldExists($tab, 'Name'); |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | $extraFields = array('Searchable' => 1, 'SimilarSearchable' => 1, 'Active' => 1, |
| 34 | 34 | 'Weight' => 0); |
| 35 | 35 | $esfs = $searchPage->ElasticaSearchableFields(); |
| 36 | - foreach ($esfs as $sf) { |
|
| 37 | - if ($sf->Name == 'Title' || $sf->Name == 'Description') { |
|
| 36 | + foreach($esfs as $sf) { |
|
| 37 | + if($sf->Name == 'Title' || $sf->Name == 'Description') { |
|
| 38 | 38 | $esfs->remove($sf); |
| 39 | 39 | $esfs->add($sf, $extraFields); |
| 40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $this->fail('Searchable fail should have failed to write'); |
| 46 | 46 | } catch (ValidationException $e) { |
| 47 | 47 | $this->assertInstanceOf('ValidationException', $e); |
| 48 | - $expected = 'The field SearchableTestPage.Title has a zero weight. ; The field '. |
|
| 48 | + $expected = 'The field SearchableTestPage.Title has a zero weight. ; The field ' . |
|
| 49 | 49 | 'SiteTree.Title has a zero weight. ; The field Page.Title has a zero weight. '; |
| 50 | 50 | $this->assertEquals($expected, $e->getMessage()); |
| 51 | 51 | } |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $extraFields = array('Searchable' => 1, 'SimilarSearchable' => 1, 'Active' => 1, |
| 65 | 65 | 'Weight' => -1); |
| 66 | 66 | $esfs = $searchPage->ElasticaSearchableFields(); |
| 67 | - foreach ($esfs as $sf) { |
|
| 68 | - if ($sf->Name == 'Title' || $sf->Name == 'Description') { |
|
| 67 | + foreach($esfs as $sf) { |
|
| 68 | + if($sf->Name == 'Title' || $sf->Name == 'Description') { |
|
| 69 | 69 | $esfs->remove($sf); |
| 70 | 70 | $esfs->add($sf, $extraFields); |
| 71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $this->fail('Searchable fail should have failed to write'); |
| 77 | 77 | } catch (ValidationException $e) { |
| 78 | 78 | $this->assertInstanceOf('ValidationException', $e); |
| 79 | - $expected = 'The field SearchableTestPage.Title has a negative weight. ; The field '. |
|
| 79 | + $expected = 'The field SearchableTestPage.Title has a negative weight. ; The field ' . |
|
| 80 | 80 | 'SiteTree.Title has a negative weight. ; The field Page.Title has a negative weight. '; |
| 81 | 81 | $this->assertEquals($expected, $e->getMessage()); |
| 82 | 82 | } |