-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from AlexandreToyer/3.0
Add support for Analyzers API
- Loading branch information
Showing
7 changed files
with
301 additions
and
1 deletion.
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
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,57 @@ | ||
<?php | ||
namespace OpenSearchServer\Analyzer; | ||
|
||
use OpenSearchServer\RequestJson; | ||
use OpenSearchServer\Request; | ||
|
||
class Create extends RequestJson | ||
{ | ||
public function __construct(array $jsonValues = null, $jsonText = null) { | ||
$this->lang(Request::LANG_UNDEFINED); | ||
parent::__construct($jsonValues, $jsonText); | ||
} | ||
|
||
/** | ||
* Specify the name of analyzer | ||
* @param string $name | ||
* @return OpenSearchServer\Analyzer\Create | ||
*/ | ||
public function name($name) { | ||
$this->options['name'] = $name; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Specify the lang of analyzer | ||
* @param string $lang | ||
* @return OpenSearchServer\Analyzer\Create | ||
*/ | ||
public function lang($lang) { | ||
$this->options['lang'] = $lang; | ||
return $this; | ||
} | ||
|
||
|
||
/****************************** | ||
* INHERITED METHODS OVERRIDDEN | ||
******************************/ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMethod() | ||
{ | ||
return self::METHOD_PUT; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getPath() | ||
{ | ||
$this->checkPathIndexNeeded(); | ||
if(empty($this->options['name'])) { | ||
throw new \Exception('Method "name($name)" must be called before submitting request.'); | ||
} | ||
return rawurlencode($this->options['index']).'/analyzer/'.rawurlencode($this->options['name']).'/lang/'.rawurlencode($this->options['lang']); | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
namespace OpenSearchServer\Analyzer; | ||
|
||
use OpenSearchServer\Request; | ||
|
||
class Get extends Request | ||
{ | ||
public function __construct(array $jsonValues = null, $jsonText = null) { | ||
$this->lang(Request::LANG_UNDEFINED); | ||
parent::__construct($jsonValues, $jsonText); | ||
} | ||
|
||
/** | ||
* Specify the name of analyzer | ||
* @param string $name | ||
* @return OpenSearchServer\Analyzer\Create | ||
*/ | ||
public function name($name) { | ||
$this->options['name'] = $name; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Specify the lang of analyzer | ||
* @param string $lang | ||
* @return OpenSearchServer\Analyzer\Create | ||
*/ | ||
public function lang($lang) { | ||
$this->options['lang'] = $lang; | ||
return $this; | ||
} | ||
|
||
/****************************** | ||
* INHERITED METHODS OVERRIDDEN | ||
******************************/ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMethod() | ||
{ | ||
return self::METHOD_GET; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getPath() | ||
{ | ||
$this->checkPathIndexNeeded(); | ||
if(empty($this->options['name'])) { | ||
throw new \Exception('Method "name($name)" must be called before submitting request.'); | ||
} | ||
return rawurlencode($this->options['index']).'/analyzer/'.rawurlencode($this->options['name']).'/lang/'.rawurlencode($this->options['lang']); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
namespace OpenSearchServer\Analyzer; | ||
|
||
use OpenSearchServer\Request; | ||
|
||
//List being a PHP reserved word this class is named GetList | ||
class GetList extends Request | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMethod() | ||
{ | ||
return self::METHOD_GET; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getPath() | ||
{ | ||
$this->checkPathIndexNeeded(); | ||
return rawurlencode($this->options['index']).'/analyzer'; | ||
} | ||
} |
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