Completed
Push — dev2 ( 85bfa2...47c047 )
by Gordon
04:06
created
src/SilverStripe/Elastica/ElasticaService.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
 	 *
134 134
 	 * @param \Elastica\Query|string|array $query
135 135
 	 * @param string|array $types List of comma separated SilverStripe classes to search, or blank for all
136
-	 * @return \Elastica\ResultList
136
+	 * @return \Elastica\ResultSet
137 137
 	 */
138 138
 	public function search($query, $types = '') {
139 139
 		$query = Query::create($query); // may be a string
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 			$types = explode(',', $types);
142 142
 		}
143 143
 
144
-        $data = $query->toArray();
144
+		$data = $query->toArray();
145 145
 		if (isset($data['query']['more_like_this'])) {
146 146
 			$query->MoreLikeThis = true;
147 147
 		} else {
@@ -164,21 +164,21 @@  discard block
 block discarded – undo
164 164
 		if ($query->MoreLikeThis) {
165 165
 			$path = $search->getPath();
166 166
 
167
-	        $termData = array();
168
-	        $termData['query'] = $data['query'];
167
+			$termData = array();
168
+			$termData['query'] = $data['query'];
169 169
 
170
-	        $path = str_replace('_search', '_validate/query', $path);
171
-	        $params = array('explain' => true, 'rewrite' => true);
172
-	        if ($this->test_mode) {
173
-	        	$params['search_type'] = Search::OPTION_SEARCH_TYPE_DFS_QUERY_THEN_FETCH;
174
-	        }
170
+			$path = str_replace('_search', '_validate/query', $path);
171
+			$params = array('explain' => true, 'rewrite' => true);
172
+			if ($this->test_mode) {
173
+				$params['search_type'] = Search::OPTION_SEARCH_TYPE_DFS_QUERY_THEN_FETCH;
174
+			}
175 175
 
176
-	        $response = $this->getClient()->request(
177
-	            $path,
178
-	            \Elastica\Request::GET,
179
-	            $termData,
180
-	            $params
181
-	        );
176
+			$response = $this->getClient()->request(
177
+				$path,
178
+				\Elastica\Request::GET,
179
+				$termData,
180
+				$params
181
+			);
182 182
 
183 183
 			$r = $response->getData();
184 184
 			$terms = null; // keep in scope
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 			}
195 195
 		}
196 196
 
197
-        if ($types) {
198
-        	foreach($types as $type) {
199
-        		$search->addType($type);
200
-        	}
201
-        }
197
+		if ($types) {
198
+			foreach($types as $type) {
199
+				$search->addType($type);
200
+			}
201
+		}
202 202
 
203
-        $path = $search->getPath();
204
-        $params = $search->getOptions();
203
+		$path = $search->getPath();
204
+		$params = $search->getOptions();
205 205
 
206 206
 		$highlightsCfg = \Config::inst()->get('Elastica', 'Highlights');
207 207
 		$preTags = $highlightsCfg['PreTags'];
@@ -269,14 +269,14 @@  discard block
 block discarded – undo
269 269
 		}
270 270
 
271 271
 
272
-        $path = $search->getPath();
273
-        $params = $search->getOptions();
272
+		$path = $search->getPath();
273
+		$params = $search->getOptions();
274 274
 		$searchResults = $search->search($query, $params);
275 275
 		if (isset($this->MoreLikeThisTerms)) {
276 276
 			$searchResults->MoreLikeThisTerms = $this->MoreLikeThisTerms;
277 277
 		}
278 278
 
279
-        return $searchResults;
279
+		return $searchResults;
280 280
 	}
281 281
 
282 282
 
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 
351 351
 	public function listIndexes($trace) {
352 352
 		$command = "curl 'localhost:9200/_cat/indices?v'";
353
-        exec($command,$op);
354
-        ElasticaUtil::message("\n++++ $trace ++++\n");
355
-        ElasticaUtil::message(print_r($op,1));
356
-        ElasticaUtil::message("++++ /{$trace} ++++\n\n");
357
-        return $op;
353
+		exec($command,$op);
354
+		ElasticaUtil::message("\n++++ $trace ++++\n");
355
+		ElasticaUtil::message(print_r($op,1));
356
+		ElasticaUtil::message("++++ /{$trace} ++++\n\n");
357
+		return $op;
358 358
 	}
359 359
 
360 360
 
@@ -525,11 +525,11 @@  discard block
 block discarded – undo
525 525
 			} else {
526 526
 				$class = new \ReflectionClass($classname);
527 527
 				while ($class = $class->getParentClass()) {
528
-				    $parentClass = $class->getName();
529
-				    if ($parentClass == 'SiteTree') {
530
-				    	$inSiteTree = true;
531
-				    	break;
532
-				    }
528
+					$parentClass = $class->getName();
529
+					if ($parentClass == 'SiteTree') {
530
+						$inSiteTree = true;
531
+						break;
532
+					}
533 533
 				}
534 534
 				self::$site_tree_classes[$classname] = $inSiteTree;
535 535
 			}
@@ -683,15 +683,15 @@  discard block
 block discarded – undo
683 683
 		//FlickrPhoto/3829/_termvector
684 684
 		$path = $this->getIndex()->getName().'/'.$searchable->ClassName.'/'.$searchable->ID.'/_termvector';
685 685
 		$response = $this->getClient()->request(
686
-	            $path,
687
-	            \Elastica\Request::GET,
688
-	            $data,
689
-	            $params
690
-	    );
686
+				$path,
687
+				\Elastica\Request::GET,
688
+				$data,
689
+				$params
690
+		);
691 691
 
692 692
 
693
-	    $data = $response->getData();
694
-	    return $data['term_vectors'];
693
+		$data = $response->getData();
694
+		return $data['term_vectors'];
695 695
 	}
696 696
 
697 697
 }
Please login to merge, or discard this patch.