Completed
Push — dev2 ( 983df6...5a7fe0 )
by Gordon
14:04
created
src/SilverStripe/Elastica/RangedAggregation.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/SilverStripe/Elastica/indexing/GermanIndexSettings.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 		$germanWithURLs = array(
29 29
 			'tokenizer' => 'uax_url_email',
30 30
 			//'filter' => array('english_possessive_stemmer', 'lowercase', 'english_stop', /*'english_keywords',*/ 'english_stemmer' ),
31
-			'filter' => array('no_single_chars', 'german_snowball', 'lowercase', 'german_stop' ),
31
+			'filter' => array('no_single_chars', 'german_snowball', 'lowercase', 'german_stop'),
32 32
 			'type' => 'custom'
33 33
 		);
34 34
 
Please login to merge, or discard this patch.
src/SilverStripe/Elastica/indexing/BaseIndexSettings.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@
 block discarded – undo
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,
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 * @param array or string $newStopWords An array of stopwords or a CSV string of stopwords
87 87
 	 */
88 88
 	public function setStopwords($newStopWords) {
89
-		if (is_array($newStopWords)) {
89
+		if(is_array($newStopWords)) {
90 90
 			$this->stopWords = $newStopWords;
91
-		} else if (is_string($newStopWords)) {
91
+		} else if(is_string($newStopWords)) {
92 92
 			$this->stopWords = explode(',', $newStopWords);
93 93
 		} else {
94 94
 			throw new Exception("ERROR: Stopwords must be a string or an array");
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 			'type' => 'nGram',
178 178
 			'min_gram' => 2,
179 179
 			'max_gram' => 20,
180
-			'token_chars' => array('letter', 'digit','punctuation', 'symbol')
180
+			'token_chars' => array('letter', 'digit', 'punctuation', 'symbol')
181 181
 		));
182 182
 
183
-		$this->addAnalyzer('autocomplete_index_analyzer',array(
183
+		$this->addAnalyzer('autocomplete_index_analyzer', array(
184 184
 			'type' => 'custom',
185 185
 			'tokenizer' => 'whitespace',
186 186
 			'filter' => array(
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			)
191 191
 		));
192 192
 
193
-		$this->addAnalyzer('autocomplete_search_analyzer',array(
193
+		$this->addAnalyzer('autocomplete_search_analyzer', array(
194 194
 			'type' => 'custom',
195 195
 			'tokenizer' => 'whitespace',
196 196
 			'filter' => array(
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		$this->analyzers['unstemmed'] = $analyzerNotStemmed;
211 211
 
212 212
 
213
-		if ($this->foldedAscii) {
213
+		if($this->foldedAscii) {
214 214
 			$analyzers['folded'] = $analyzerFolded;
215 215
 		}
216 216
 
Please login to merge, or discard this patch.
src/SilverStripe/Elastica/indexing/EnglishIndexSettings.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 		$englishWithURLs = array(
48 48
 			'tokenizer' => 'uax_url_email',
49 49
 			//'filter' => array('english_possessive_stemmer', 'lowercase', 'english_stop', /*'english_keywords',*/ 'english_stemmer' ),
50
-			'filter' => array('no_single_chars', 'english_snowball', 'lowercase', $this->stopWordFilter ),
50
+			'filter' => array('no_single_chars', 'english_snowball', 'lowercase', $this->stopWordFilter),
51 51
 			'type' => 'custom'
52 52
 		);
53 53
 
Please login to merge, or discard this patch.
src/SilverStripe/Elastica/QueryGenerator.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -511,7 +511,7 @@
 block discarded – undo
511 511
 				}
512 512
 			}
513 513
 			$cache->save(json_encode($result),$key);
514
-		}  else {
514
+		} else {
515 515
 			// true is necessary here to decode the array hash back to an array and not a struct
516 516
 			self::$cacheHitCtr++;
517 517
 			$result = json_decode($result,true);
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 		$queryTextExists = ($this->queryText != '');
127 127
 		$isMultiMatch = ($this->fields != null);
128 128
 
129
-		if ($this->selectedFilters == null) {
129
+		if($this->selectedFilters == null) {
130 130
 			$this->selectedFilters = array();
131 131
 		}
132 132
 
133 133
 		$this->manipulatorInstance = null;
134
-		if ($this->manipulator) {
134
+		if($this->manipulator) {
135 135
 			$this->manipulatorInstance = \Injector::inst()->create($this->manipulator);
136 136
 			$this->manipulatorInstance->queryGenerator = $this;
137 137
 			$this->manipulatorInstance->originalQueryString = $this->queryText;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		//This is a query_string object
141 141
 		$textQuery = null;
142 142
 
143
-		if (!$isMultiMatch) {
143
+		if(!$isMultiMatch) {
144 144
 			$textQuery = $this->simpleTextQuery();
145 145
 		} else {
146 146
 			$textQuery = $this->multiMatchQuery();
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		$query->setLimit($this->pageLength);
160 160
 		$query->setFrom($this->start);
161 161
 
162
-		if ($this->manipulatorInstance && !$queryTextExists) {
162
+		if($this->manipulatorInstance && !$queryTextExists) {
163 163
 			$sort = $this->manipulatorInstance->getDefaultSort();
164 164
 			$query->setSort($sort);
165 165
 		}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			'size' => 10,
191 191
 			'query' => array(
192 192
 				'match' => array(
193
-					$field.'.autocomplete' => array(
193
+					$field . '.autocomplete' => array(
194 194
 						'query' => $this->queryText,
195 195
 						'operator' => 'and'
196 196
 					)
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		);
200 200
 
201 201
 		// The query clause can only have one entry, so a bit of mangling
202
-		if (!empty($this->selectedFilters)) {
202
+		if(!empty($this->selectedFilters)) {
203 203
 			$filtered = array();
204 204
 			$filtered['query'] = $data['query'];
205 205
 			unset($data['query']);
@@ -228,17 +228,17 @@  discard block
 block discarded – undo
228 228
 	 * @param Elastica\Query\QueryString $textQuery A query_string representing the current query
229 229
 	 */
230 230
 	private function addFilters($textQuery) {
231
-		if ($this->manipulator) {
231
+		if($this->manipulator) {
232 232
 			$this->manipulatorInstance->updateFilters($this->selectedFilters);
233 233
 		}
234 234
 
235 235
 		$elFilters = array();
236 236
 		$rangeFilterKeys = RangedAggregation::getTitles();
237 237
 
238
-		foreach ($this->selectedFilters as $key => $value) {
239
-			if (!in_array($key, $rangeFilterKeys)) {
238
+		foreach($this->selectedFilters as $key => $value) {
239
+			if(!in_array($key, $rangeFilterKeys)) {
240 240
 				$filter = new Term();
241
-				$filter->setTerm($key,$value);
241
+				$filter->setTerm($key, $value);
242 242
 				$elFilters[] = $filter;
243 243
 			} else {
244 244
 				// get the selected range filter
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 		// if not facets selected, pass through null
253 253
 		$queryFilter = null;
254
-		switch (count($this->selectedFilters)) {
254
+		switch(count($this->selectedFilters)) {
255 255
 			case 0:
256 256
 				// filter already null
257 257
 				break;
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
 			default:
262 262
 				$queryFilter = new BoolAnd();
263 263
 
264
-				foreach ($elFilters as $filter) {
264
+				foreach($elFilters as $filter) {
265 265
 					$queryFilter->addFilter($filter);
266 266
 				}
267 267
 				break;
268 268
 		}
269 269
 
270 270
 		// the Elastica query object
271
-		if ($queryFilter == null) {
271
+		if($queryFilter == null) {
272 272
 			$query = new Query($textQuery);
273 273
 		} else {
274 274
 			//MatchAll appears not be allowed inside a filtered query which is a bit of a pain.
275
-			if ($textQuery instanceof MatchAll) {
275
+			if($textQuery instanceof MatchAll) {
276 276
 				$textQuery = null;
277 277
 			}
278 278
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
 	private function addAggregation(&$query) {
291 291
 		// aggregation (optional)
292
-		if ($this->manipulatorInstance) {
292
+		if($this->manipulatorInstance) {
293 293
 			$this->manipulatorInstance->augmentQuery($query);
294 294
 		}
295 295
 	}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 		//Setting the lenient flag means that numeric fields can be searched for text values
317 317
 		$textQuery->setParam('lenient', true);
318 318
 
319
-		if ($this->showResultsForEmptyQuery && $this->queryText == '') {
319
+		if($this->showResultsForEmptyQuery && $this->queryText == '') {
320 320
 			$textQuery = new MatchAll();
321 321
 		}
322 322
 
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 		$textQuery = new MultiMatch();
330 330
 
331 331
 		// Differing cases for showing and not showing empty string
332
-		if ($this->queryText == '') {
333
-			if (!$this->showResultsForEmptyQuery) {
332
+		if($this->queryText == '') {
333
+			if(!$this->showResultsForEmptyQuery) {
334 334
 				$textQuery->setQuery('');
335 335
 			} else {
336 336
 				//WIP
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 			$textQuery->setQuery($this->queryText);
344 344
 		}
345 345
 
346
-		if ($textQuery instanceof MultiMatch) {
346
+		if($textQuery instanceof MultiMatch) {
347 347
 			$elasticaFields = $this->convertWeightedFieldsForElastica($this->fields);
348 348
 			$textQuery->setFields($elasticaFields);
349 349
 			$textQuery->setType('most_fields');
@@ -366,20 +366,20 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	public function convertWeightedFieldsForElastica($fields) {
368 368
 		$result = array();
369
-		$nameToType = self::getSearchFieldsMappingForClasses($this->classes,$fields);
369
+		$nameToType = self::getSearchFieldsMappingForClasses($this->classes, $fields);
370 370
 
371
-		if (sizeof($fields) != 0) {
372
-			foreach ($fields as $fieldName => $weight) {
371
+		if(sizeof($fields) != 0) {
372
+			foreach($fields as $fieldName => $weight) {
373 373
 				$fieldCfg = "$fieldName";
374
-				if ($weight != 1) {
375
-					$fieldCfg .= '^'.$weight;
374
+				if($weight != 1) {
375
+					$fieldCfg .= '^' . $weight;
376 376
 				}
377 377
 				array_push($result, $fieldCfg);
378
-				if (isset($nameToType[$fieldName])) {
379
-					if ($nameToType[$fieldName] == 'string') {
378
+				if(isset($nameToType[$fieldName])) {
379
+					if($nameToType[$fieldName] == 'string') {
380 380
 						$fieldCfg = "{$fieldName}.*";
381
-						if ($weight != 1) {
382
-							$fieldCfg .= '^'.$weight;
381
+						if($weight != 1) {
382
+							$fieldCfg .= '^' . $weight;
383 383
 						}
384 384
 						array_push($result, $fieldCfg);
385 385
 					}
@@ -405,29 +405,29 @@  discard block
 block discarded – undo
405 405
 		// Get a array of relevant classes to search
406 406
 		$cache = QueryGenerator::getCache();
407 407
 		$csvClasses = $classes;
408
-		if (is_array($classes)) {
409
-			$csvClasses = implode(',',$classes);
408
+		if(is_array($classes)) {
409
+			$csvClasses = implode(',', $classes);
410 410
 		}
411 411
 
412 412
 		error_log("CSV CLASSES: $csvClasses");
413 413
 
414
-		$key ='SEARCHABLE_FIELDS_'.str_replace(',', '_', $csvClasses);
414
+		$key = 'SEARCHABLE_FIELDS_' . str_replace(',', '_', $csvClasses);
415 415
 
416
-		if ($fieldsAllowed) {
416
+		if($fieldsAllowed) {
417 417
 			$fieldsAllowedCSV = self::convertToQuotedCSV(array_keys($fieldsAllowed));
418
-			$key .= '_' . str_replace(',', '_', str_replace("'", '_',$fieldsAllowedCSV));
418
+			$key .= '_' . str_replace(',', '_', str_replace("'", '_', $fieldsAllowedCSV));
419 419
 			$key = str_replace('.', '_', $key);
420 420
 			$key = str_replace(' ', '_', $key);
421 421
 		}
422 422
 
423 423
 		$result = $cache->load($key);
424 424
 		error_log("RESULT:$result for key $key \n");
425
-		if (!$result) {
425
+		if(!$result) {
426 426
 			$relevantClasses = array();
427
-			if (empty($csvClasses)) {
427
+			if(empty($csvClasses)) {
428 428
 				$sql = "SELECT DISTINCT Name from SearchableClass where InSiteTree = 1 order by Name";
429 429
 				$records = \DB::query($sql);
430
-				foreach ($records as $record) {
430
+				foreach($records as $record) {
431 431
 					array_push($relevantClasses, $record['Name']);
432 432
 				}
433 433
 			} else {
@@ -435,21 +435,21 @@  discard block
 block discarded – undo
435 435
 			}
436 436
 
437 437
 			$result = array();
438
-			if (sizeof($relevantClasses) > 0) {
438
+			if(sizeof($relevantClasses) > 0) {
439 439
 				$relevantClassesCSV = self::convertToQuotedCSV($relevantClasses);
440 440
 
441 441
 				//Perform a database query to get get a list of searchable fieldnames to Elasticsearch mapping
442 442
 				$sql = "SELECT  sf.Name,sf.Type FROM SearchableClass sc  INNER JOIN SearchableField sf ON "
443 443
 					 . "sc.id = sf.SearchableClassID WHERE sc.name IN ($relevantClassesCSV)";
444
-				if ($fieldsAllowed) {
444
+				if($fieldsAllowed) {
445 445
 					$fieldsAllowedCSV = self::convertToQuotedCSV(array_keys($fieldsAllowed));
446
-					if (strlen($fieldsAllowedCSV) > 0) {
446
+					if(strlen($fieldsAllowedCSV) > 0) {
447 447
 						$sql .= " AND sf.Name IN ($fieldsAllowedCSV)";
448 448
 					}
449 449
 				}
450 450
 
451 451
 				$records = \DB::query($sql);
452
-				foreach ($records as $record) {
452
+				foreach($records as $record) {
453 453
 					$name = $record['Name'];
454 454
 					$type = $record['Type'];
455 455
 
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 					$result[$name] = $type;
464 464
 				}
465 465
 			}
466
-			$cache->save(json_encode($result),$key);
467
-		}  else {
466
+			$cache->save(json_encode($result), $key);
467
+		} else {
468 468
 			// true is necessary here to decode the array hash back to an array and not a struct
469 469
 			self::$cacheHitCtr++;
470
-			$result = json_decode($result,true);
470
+			$result = json_decode($result, true);
471 471
 		}
472 472
 
473 473
 		return $result;
@@ -488,21 +488,21 @@  discard block
 block discarded – undo
488 488
 	 */
489 489
 	public static function convertToQuotedCSV($csvOrArray) {
490 490
 		$asArray = $csvOrArray;
491
-		if (!is_array($csvOrArray)) {
492
-			if ($csvOrArray == null) {
491
+		if(!is_array($csvOrArray)) {
492
+			if($csvOrArray == null) {
493 493
 				$asArray = array();
494 494
 			} else {
495 495
 				$asArray = explode(',', $csvOrArray);
496 496
 			}
497 497
 		}
498 498
 		$quoted = array();
499
-		foreach ($asArray as $value) {
500
-			if (strlen($value) > 0) {
501
-				$item = "'".$value."'";
499
+		foreach($asArray as $value) {
500
+			if(strlen($value) > 0) {
501
+				$item = "'" . $value . "'";
502 502
 				array_push($quoted, $item);
503 503
 			}
504 504
 
505 505
 		}
506
-		return implode(',', $quoted);;
506
+		return implode(',', $quoted); ;
507 507
 	}
508 508
 }
Please login to merge, or discard this patch.
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@  discard block
 block discarded – undo
47 47
 	private $classes = '';
48 48
 
49 49
 
50
+	/**
51
+	 * @param string $newQueryText
52
+	 */
50 53
 	public function setQueryText($newQueryText) {
51 54
 		$this->queryText = $newQueryText;
52 55
 	}
@@ -62,6 +65,9 @@  discard block
 block discarded – undo
62 65
 	}
63 66
 
64 67
 
68
+	/**
69
+	 * @param boolean $newShowResultsForEmptyQuery
70
+	 */
65 71
 	public function setShowResultsForEmptyQuery($newShowResultsForEmptyQuery) {
66 72
 		$this->showResultsForEmptyQuery = $newShowResultsForEmptyQuery;
67 73
 	}
@@ -72,11 +78,17 @@  discard block
 block discarded – undo
72 78
 	}
73 79
 
74 80
 
81
+	/**
82
+	 * @param integer $newPageLength
83
+	 */
75 84
 	public function setPageLength($newPageLength) {
76 85
 		$this->pageLength = $newPageLength;
77 86
 	}
78 87
 
79 88
 
89
+	/**
90
+	 * @param integer $newStart
91
+	 */
80 92
 	public function setStart($newStart) {
81 93
 		$this->start = $newStart;
82 94
 	}
@@ -287,6 +299,9 @@  discard block
 block discarded – undo
287 299
 	}
288 300
 
289 301
 
302
+	/**
303
+	 * @param Query $query
304
+	 */
290 305
 	private function addAggregation(&$query) {
291 306
 		// aggregation (optional)
292 307
 		if ($this->manipulatorInstance) {
Please login to merge, or discard this patch.
searchpage/ElasticSearchForm.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
tests/SearchableTest.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -479,6 +479,9 @@
 block discarded – undo
479 479
 	}
480 480
 
481 481
 
482
+	/**
483
+	 * @param string $query
484
+	 */
482 485
 	private function getResultsFor($query, $pageLength = 10, $fields = array('Title' => 1, 'Description' => 1)) {
483 486
 		$es = new ElasticSearcher();
484 487
 		$es->setStart(0);
Please login to merge, or discard this patch.
code/AutoCompleteOption.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		parent::requireDefaultRecords();
28 28
 
29 29
 		$similar = AutoCompleteOption::get()->filter('Name', 'Similar')->first();
30
-		if (!$similar) {
30
+		if(!$similar) {
31 31
 			$similar = new AutoCompleteOption();
32 32
 			$similar->Name = 'Similar';
33 33
 			$similar->Slug = 'SIMILAR';
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 
39 39
 		$search = AutoCompleteOption::get()->filter('Name', 'Search')->first();
40
-		if (!$search) {
40
+		if(!$search) {
41 41
 			$search = new AutoCompleteOption();
42 42
 			$search->Name = 'Search';
43 43
 			$search->Description = 'Find records similar to the selected item';
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 
49 49
 		$goto = AutoCompleteOption::get()->filter('Name', 'GoToRecord')->first();
50
-		if (!$goto) {
50
+		if(!$goto) {
51 51
 			$goto = new AutoCompleteOption();
52 52
 			$goto->Name = 'GoToRecord';
53 53
 			$goto->Description = 'Go to the page of the selected item, found by the Link() method';
Please login to merge, or discard this patch.
code/ElasticaAutoCompleteController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,24 +20,24 @@
 block discarded – undo
20 20
 		// Makes most sense to only provide one field here, e.g. Title, Name
21 21
 		$field = $this->request->getVar('field');
22 22
 
23
-		error_log('QUERY:'.$query);
23
+		error_log('QUERY:' . $query);
24 24
 
25 25
 		// start, and page length, i.e. pagination
26 26
 		$es->setPageLength(10);
27
-		if ($classes) {
27
+		if($classes) {
28 28
 			$es->setClasses($classes);
29 29
 		}
30 30
 
31
-		if ($filter) {
31
+		if($filter) {
32 32
 			$es->addFilter('InSiteTree', true);
33 33
 		}
34 34
 
35
-		$resultList = $es->autocomplete_search($query,$field);
35
+		$resultList = $es->autocomplete_search($query, $field);
36 36
 		$result = array();
37 37
 		$result['Query'] = $query;
38 38
 		$suggestions = array();
39 39
 
40
-		foreach ($resultList->getResults() as $singleResult) {
40
+		foreach($resultList->getResults() as $singleResult) {
41 41
 			$suggestion = array('value' => $singleResult->Title);
42 42
 			$suggestion['data'] = array(
43 43
 				'ID' => $singleResult->getParam('_id'),
Please login to merge, or discard this patch.