@@ -141,7 +141,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |