@@ -29,20 +29,20 @@ discard block |
||
| 29 | 29 | $config->removeComponent($config->getComponentByType('GridFieldDeleteAction')); |
| 30 | 30 | |
| 31 | 31 | $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array( |
| 32 | - 'Name' => 'Name', |
|
| 33 | - 'Weight' => 'Weighting', |
|
| 34 | - 'Searchable' => 'Search this field?' |
|
| 35 | - )); |
|
| 32 | + 'Name' => 'Name', |
|
| 33 | + 'Weight' => 'Weighting', |
|
| 34 | + 'Searchable' => 'Search this field?' |
|
| 35 | + )); |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - $gridField = new GridField( |
|
| 39 | - 'SearchableField', // Field name |
|
| 40 | - 'Field Name', // Field title |
|
| 41 | - SearchableField::get()->filter('SearchableClassID', $this->ID)->sort('Name'), |
|
| 42 | - $config |
|
| 43 | - ); |
|
| 38 | + $gridField = new GridField( |
|
| 39 | + 'SearchableField', // Field name |
|
| 40 | + 'Field Name', // Field title |
|
| 41 | + SearchableField::get()->filter('SearchableClassID', $this->ID)->sort('Name'), |
|
| 42 | + $config |
|
| 43 | + ); |
|
| 44 | 44 | |
| 45 | - $fields->addFieldToTab('Root.Main', $gridField); |
|
| 45 | + $fields->addFieldToTab('Root.Main', $gridField); |
|
| 46 | 46 | |
| 47 | 47 | /* |
| 48 | 48 | $fields = new FieldList(); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | */ |
| 53 | - return $fields; |
|
| 53 | + return $fields; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -208,11 +208,11 @@ |
||
| 208 | 208 | */ |
| 209 | 209 | public function invokeMethod(&$object, $methodName, array $parameters = array()) |
| 210 | 210 | { |
| 211 | - $reflection = new \ReflectionClass(get_class($object)); |
|
| 212 | - $method = $reflection->getMethod($methodName); |
|
| 213 | - $method->setAccessible(true); |
|
| 211 | + $reflection = new \ReflectionClass(get_class($object)); |
|
| 212 | + $method = $reflection->getMethod($methodName); |
|
| 213 | + $method->setAccessible(true); |
|
| 214 | 214 | |
| 215 | - return $method->invokeArgs($object, $parameters); |
|
| 215 | + return $method->invokeArgs($object, $parameters); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | |
@@ -139,37 +139,37 @@ discard block |
||
| 139 | 139 | * Add a mapping for the location of the photograph |
| 140 | 140 | */ |
| 141 | 141 | public function updateElasticsearchMapping(\Elastica\Type\Mapping $mapping) |
| 142 | - { |
|
| 143 | - // get the properties of the individual fields as an array |
|
| 144 | - $properties = $mapping->getProperties(); |
|
| 145 | - |
|
| 146 | - // add a location with geo point |
|
| 147 | - $precision1cm = array('format' => 'compressed', 'precision' => '1cm'); |
|
| 148 | - $properties['location'] = array( |
|
| 149 | - 'type' => 'geo_point', |
|
| 150 | - 'fielddata' => $precision1cm, |
|
| 151 | - ); |
|
| 152 | - |
|
| 153 | - $properties['ShutterSpeed'] = array( |
|
| 154 | - 'type' => 'string', |
|
| 155 | - 'index' => 'not_analyzed' |
|
| 142 | + { |
|
| 143 | + // get the properties of the individual fields as an array |
|
| 144 | + $properties = $mapping->getProperties(); |
|
| 145 | + |
|
| 146 | + // add a location with geo point |
|
| 147 | + $precision1cm = array('format' => 'compressed', 'precision' => '1cm'); |
|
| 148 | + $properties['location'] = array( |
|
| 149 | + 'type' => 'geo_point', |
|
| 150 | + 'fielddata' => $precision1cm, |
|
| 156 | 151 | ); |
| 157 | 152 | |
| 158 | - $properties['Aperture'] = array( |
|
| 159 | - // do not use float as the rounding makes facets impossible |
|
| 160 | - 'type' => 'double' |
|
| 161 | - ); |
|
| 153 | + $properties['ShutterSpeed'] = array( |
|
| 154 | + 'type' => 'string', |
|
| 155 | + 'index' => 'not_analyzed' |
|
| 156 | + ); |
|
| 162 | 157 | |
| 163 | - $properties['FlickrID'] = array('type' => 'integer'); |
|
| 158 | + $properties['Aperture'] = array( |
|
| 159 | + // do not use float as the rounding makes facets impossible |
|
| 160 | + 'type' => 'double' |
|
| 161 | + ); |
|
| 164 | 162 | |
| 165 | - // by default casted as a string, we want a date 2015-07-25 18:15:33 y-M-d H:m:s |
|
| 166 | - //$properties['TakenAt'] = array('type' => 'date', 'format' => 'y-M-d H:m:s'); |
|
| 163 | + $properties['FlickrID'] = array('type' => 'integer'); |
|
| 167 | 164 | |
| 168 | - // set the new properties on the mapping |
|
| 169 | - $mapping->setProperties($properties); |
|
| 165 | + // by default casted as a string, we want a date 2015-07-25 18:15:33 y-M-d H:m:s |
|
| 166 | + //$properties['TakenAt'] = array('type' => 'date', 'format' => 'y-M-d H:m:s'); |
|
| 170 | 167 | |
| 171 | - return $mapping; |
|
| 172 | - } |
|
| 168 | + // set the new properties on the mapping |
|
| 169 | + $mapping->setProperties($properties); |
|
| 170 | + |
|
| 171 | + return $mapping; |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | $sortable = $sortable . '|' . $this->owner->ShutterSpeed; |
| 207 | 207 | $document->set('ShutterSpeed', $sortable); |
| 208 | - return $document; |
|
| 208 | + return $document; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | public function __construct() { |
| 12 | 12 | $aspectAgg = new RangedAggregation('Aspect', 'AspectRatio'); |
| 13 | - $aspectAgg->addRange(0.0000001, 0.3, 'Panoramic'); |
|
| 14 | - $aspectAgg->addRange(0.3, 0.9, 'Horizontal'); |
|
| 15 | - $aspectAgg->addRange(0.9, 1.2, 'Square'); |
|
| 16 | - $aspectAgg->addRange(1.2, 1.79, 'Vertical'); |
|
| 17 | - $aspectAgg->addRange(1.79, 1e7, 'Tallest'); |
|
| 13 | + $aspectAgg->addRange(0.0000001, 0.3, 'Panoramic'); |
|
| 14 | + $aspectAgg->addRange(0.3, 0.9, 'Horizontal'); |
|
| 15 | + $aspectAgg->addRange(0.9, 1.2, 'Square'); |
|
| 16 | + $aspectAgg->addRange(1.2, 1.79, 'Vertical'); |
|
| 17 | + $aspectAgg->addRange(1.79, 1e7, 'Tallest'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | private static $titleFieldMapping = array( |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | $aspectRangedAgg = RangedAggregation::getByTitle('Aspect'); |
| 76 | - $query->addAggregation($aspectRangedAgg->getRangeAgg()); |
|
| 76 | + $query->addAggregation($aspectRangedAgg->getRangeAgg()); |
|
| 77 | 77 | |
| 78 | 78 | // leave this out for the moment as way too many terms being returned slowing things down |
| 79 | 79 | /* |
@@ -140,7 +140,7 @@ |
||
| 140 | 140 | |
| 141 | 141 | public function testEach() { |
| 142 | 142 | $callback = function($fp) { |
| 143 | - $this->assertTrue(true, 'Callback reached'); |
|
| 143 | + $this->assertTrue(true, 'Callback reached'); |
|
| 144 | 144 | }; |
| 145 | 145 | $resultList = $this->getResultsFor('New Zealand',10); |
| 146 | 146 | $resultList->each($callback); |
@@ -434,11 +434,11 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | |
| 436 | 436 | |
| 437 | - $query = new Query(); |
|
| 438 | - $query->setParams(array('query' => array('more_like_this' => $mlt))); |
|
| 437 | + $query = new Query(); |
|
| 438 | + $query->setParams(array('query' => array('more_like_this' => $mlt))); |
|
| 439 | 439 | |
| 440 | 440 | |
| 441 | - $elasticService = \Injector::inst()->create('SilverStripe\Elastica\ElasticaService'); |
|
| 441 | + $elasticService = \Injector::inst()->create('SilverStripe\Elastica\ElasticaService'); |
|
| 442 | 442 | $elasticService->setLocale($this->locale); |
| 443 | 443 | if ($testMode) { |
| 444 | 444 | $elasticService->setTestMode(true); |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $query->setFrom($this->start); |
| 451 | 451 | |
| 452 | 452 | $resultList = new ResultList($elasticService, $query, null); |
| 453 | - // at this point ResultList object, not yet executed search query |
|
| 453 | + // at this point ResultList object, not yet executed search query |
|
| 454 | 454 | $paginated = new \PaginatedList( |
| 455 | 455 | $resultList |
| 456 | 456 | ); |
@@ -38,8 +38,8 @@ |
||
| 38 | 38 | $to = $range['to']; |
| 39 | 39 | } |
| 40 | 40 | $rangeFilter = array('gte' => (string)$from, 'lt' => (string)$to); |
| 41 | - $filter = new \Elastica\Filter\Range('AspectRatio', $rangeFilter); |
|
| 42 | - $result = $filter; |
|
| 41 | + $filter = new \Elastica\Filter\Range('AspectRatio', $rangeFilter); |
|
| 42 | + $result = $filter; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
@@ -214,7 +214,7 @@ |
||
| 214 | 214 | $analyzers['folded'] = $analyzerFolded; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - //Store bigrams in the index, namely pairs of words |
|
| 217 | + //Store bigrams in the index, namely pairs of words |
|
| 218 | 218 | $this->addFilter('filter_shingle', array( |
| 219 | 219 | 'type' => 'shingle', |
| 220 | 220 | 'min_shingle_size' => 2, |
@@ -27,17 +27,17 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function __construct($controller, $name, $fields = null, $actions = null) { |
| 29 | 29 | $searchText = isset($this->Query) ? $this->Query : ''; |
| 30 | - $fields = new FieldList( |
|
| 31 | - $tf = new TextField("q", "", $searchText) |
|
| 32 | - ); |
|
| 30 | + $fields = new FieldList( |
|
| 31 | + $tf = new TextField("q", "", $searchText) |
|
| 32 | + ); |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | - $buttonText = _t('SearchPage.SEARCH', 'Search'); |
|
| 36 | - $actions = new FieldList( |
|
| 37 | - $fa = new FormAction('submit', $buttonText) |
|
| 38 | - ); |
|
| 35 | + $buttonText = _t('SearchPage.SEARCH', 'Search'); |
|
| 36 | + $actions = new FieldList( |
|
| 37 | + $fa = new FormAction('submit', $buttonText) |
|
| 38 | + ); |
|
| 39 | 39 | |
| 40 | - $this->SubmitButton = $fa; |
|
| 40 | + $this->SubmitButton = $fa; |
|
| 41 | 41 | |
| 42 | 42 | if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable')) { |
| 43 | 43 | $fields->push(new HiddenField('searchlocale', 'searchlocale', Translatable::get_current_locale())); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function setButtonText($newButtonText) { |
| 66 | 66 | $this->actions = new FieldList( |
| 67 | - $fa = new FormAction('submit', $newButtonText) |
|
| 68 | - ); |
|
| 67 | + $fa = new FormAction('submit', $newButtonText) |
|
| 68 | + ); |
|
| 69 | 69 | } |
| 70 | 70 | } |