-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74da187
commit c67c0dd
Showing
2 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
/** | ||
* User: zach | ||
* Date: 05/31/2013 | ||
* Time: 16:47:11 pm | ||
*/ | ||
|
||
namespace Elasticsearch\Endpoints; | ||
|
||
use Elasticsearch\Endpoints\AbstractEndpoint; | ||
use Elasticsearch\Common\Exceptions; | ||
|
||
/** | ||
* Class TermVector | ||
* @package Elasticsearch\Endpoints | ||
*/ | ||
class TermVector extends AbstractEndpoint | ||
{ | ||
|
||
/** | ||
* @param array $body | ||
* | ||
* @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException | ||
* @return $this | ||
*/ | ||
public function setBody($body) | ||
{ | ||
if (isset($body) !== true) { | ||
return $this; | ||
} | ||
|
||
$this->body = $body; | ||
return $this; | ||
} | ||
|
||
|
||
/** | ||
* @throws \Elasticsearch\Common\Exceptions\RuntimeException | ||
* @return string | ||
*/ | ||
protected function getURI() | ||
{ | ||
if (isset($this->index) !== true) { | ||
throw new Exceptions\RuntimeException( | ||
'index is required for TermVector' | ||
); | ||
} | ||
if (isset($this->type) !== true) { | ||
throw new Exceptions\RuntimeException( | ||
'type is required for TermVector' | ||
); | ||
} | ||
if (isset($this->id) !== true) { | ||
throw new Exceptions\RuntimeException( | ||
'id is required for TermVector' | ||
); | ||
} | ||
|
||
$index = $this->index; | ||
$type = $this->type; | ||
$id = $this->id; | ||
$uri = "/$index/$type/$id/_termvector"; | ||
|
||
return $uri; | ||
|
||
} | ||
|
||
/** | ||
* @return string[] | ||
*/ | ||
protected function getParamWhitelist() | ||
{ | ||
return array( | ||
'term_statistics', | ||
'field_statistics', | ||
'fields', | ||
'offsets', | ||
'positions', | ||
'payloads', | ||
'preference', | ||
'routing', | ||
'parent' | ||
); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getMethod() | ||
{ | ||
return 'POST'; | ||
} | ||
} |