Completed
Push — dev2 ( 450ef9...0e4396 )
by Gordon
03:13
created
searchpage/ElasticSearchPage.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	);
63 63
 
64 64
 	private static $many_many_extraFields = array(
65
-    	'ElasticaSearchableFields' => array(
65
+		'ElasticaSearchableFields' => array(
66 66
 		'Searchable' => 'Boolean', // allows the option of turning off a single field for searching
67 67
 		'SimilarSearchable' => 'Boolean', // allows field to be used in more like this queries.
68 68
 		'Active' => 'Boolean', // preserve previous edits of weighting when classes changed
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 		$sortedWords = $this->SimilarityStopWords;
105 105
 
106 106
 		$stopwordsField = StringTagField::create(
107
-		    'SimilarityStopWords',
108
-		    'Stop Words for Similar Search',
109
-		    $sortedWords,
110
-		    $sortedWords
107
+			'SimilarityStopWords',
108
+			'Stop Words for Similar Search',
109
+			$sortedWords,
110
+			$sortedWords
111 111
 		);
112 112
 
113 113
 		$stopwordsField->setShouldLazyLoad(true); // tags should be lazy loaded
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
 		$fields->addFieldToTab('Root.Search.Aggregations', new TextField('SearchHelper',
191 191
 			'ClassName of object to manipulate search details and results.  Leave blank for standard search'));
192 192
 
193
-        $ottos = AutoCompleteOption::get()->Filter('Locale', $this->Locale)->map('ID', 'Name')->
194
-        									toArray();
195
-        $df = DropdownField::create('AutoCompleteFunctionID', 'Autocomplete Function')->
196
-        							setSource($ottos);
197
-        $df->setEmptyString('-- Please select what do do after find as you type has occurred --');
193
+		$ottos = AutoCompleteOption::get()->Filter('Locale', $this->Locale)->map('ID', 'Name')->
194
+											toArray();
195
+		$df = DropdownField::create('AutoCompleteFunctionID', 'Autocomplete Function')->
196
+									setSource($ottos);
197
+		$df->setEmptyString('-- Please select what do do after find as you type has occurred --');
198 198
 
199
-        $ottos = $this->ElasticaSearchableFields()->filter('EnableAutocomplete',1)->Map('ID', 'Name')->toArray();
200
-        $autoCompleteFieldDF = DropDownField::create('AutoCompleteFieldID', 'Field to use for autocomplete')->setSource($ottos);
201
-        $autoCompleteFieldDF->setEmptyString('-- Please select which field to use for autocomplete --');
199
+		$ottos = $this->ElasticaSearchableFields()->filter('EnableAutocomplete',1)->Map('ID', 'Name')->toArray();
200
+		$autoCompleteFieldDF = DropDownField::create('AutoCompleteFieldID', 'Field to use for autocomplete')->setSource($ottos);
201
+		$autoCompleteFieldDF->setEmptyString('-- Please select which field to use for autocomplete --');
202 202
 
203 203
 		$fields->addFieldToTab("Root.Search.AutoComplete",
204 204
 		  		FieldGroup::create(
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 		$pickerConfig->removeComponentsByType(new PickerFieldAddExistingSearchButton());
224 224
 		$pickerConfig->getComponentByType('GridFieldPaginator')->setItemsPerPage(100);
225 225
 
226
-        $searchPicker->enableEdit();
226
+		$searchPicker->enableEdit();
227 227
 		$edittest = $pickerConfig->getComponentByType('GridFieldDetailForm');
228 228
 		$edittest->setFields(FieldList::create(
229 229
 			TextField::create('Name', 'Field Name'),
@@ -257,23 +257,23 @@  discard block
 block discarded – undo
257 257
 
258 258
 		// What do display on the grid of searchable fields
259 259
 		$dataColumns = $pickerConfig->getComponentByType('GridFieldDataColumns');
260
-        $dataColumns->setDisplayFields(array(
260
+		$dataColumns->setDisplayFields(array(
261 261
 			'Name' => 'Name',
262
-        	'ClazzName' => 'Class',
262
+			'ClazzName' => 'Class',
263 263
 			'Type' => 'Type',
264 264
 			'Searchable' => 'Use for Search?',
265 265
 			'SimilarSearchable' => 'Use for Similar Search?',
266 266
 			'ShowHighlights' => 'Show Search Highlights',
267 267
 			'Weight' => 'Weighting'
268
-        ));
268
+		));
269 269
 
270 270
 		return $fields;
271 271
 	}
272 272
 
273 273
 
274 274
 	public function getCMSValidator() {
275
-        return new ElasticSearchPage_Validator();
276
-    }
275
+		return new ElasticSearchPage_Validator();
276
+	}
277 277
 
278 278
 
279 279
 	/**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 		$esfs = $this->ElasticaSearchableFields();
359 359
 
360 360
 		// Remove existing searchable fields for this page from the list of all available
361
-    	$delta = array_keys($esfs->map()->toArray());
361
+		$delta = array_keys($esfs->map()->toArray());
362 362
 		$newSearchableFields = $sfs->exclude('ID', $delta);
363 363
 
364 364
 		if ($newSearchableFields->count() > 0) {
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 		Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
449 449
 		Requirements::javascript("elastica/javascript/jquery.autocomplete.js");
450 450
 		Requirements::javascript("elastica/javascript/elastica.js");
451
-        Requirements::css("elastica/css/elastica.css");
451
+		Requirements::css("elastica/css/elastica.css");
452 452
 	}
453 453
 
454 454
 
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 
523 523
 		try {
524 524
 			// Simulate server being down for testing purposes
525
-	        if (isset($_GET['ServerDown'])) {
526
-	        	throw new Elastica\Exception\Connection\HttpException('Unable to reach search server');
527
-	        }
525
+			if (isset($_GET['ServerDown'])) {
526
+				throw new Elastica\Exception\Connection\HttpException('Unable to reach search server');
527
+			}
528 528
 			if (class_exists($class)) {
529 529
 				$instance = \DataObject::get_by_id($class,$instanceID);
530 530
 
@@ -664,9 +664,9 @@  discard block
 block discarded – undo
664 664
 		$paginated = null;
665 665
 		try {
666 666
 			// Simulate server being down for testing purposes
667
-	        if (isset($_GET['ServerDown'])) {
668
-	        	throw new Elastica\Exception\Connection\HttpException('Unable to reach search server');
669
-	        }
667
+			if (isset($_GET['ServerDown'])) {
668
+				throw new Elastica\Exception\Connection\HttpException('Unable to reach search server');
669
+			}
670 670
 
671 671
 			// now actually perform the search using the original query
672 672
 			$paginated = $es->search($queryText, $fieldsToSearch, $testMode);
Please login to merge, or discard this patch.