Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/fulltextsearch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/Model
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-01-04 13:13:58 +0300
committerMaxence Lange <maxence@artificial-owl.com>2018-01-04 13:13:58 +0300
commit985f19ff32ddab1cfb3871c46ba6d0da0e6a53d1 (patch)
tree5cda7ea261d3112718fcf11ec152b8f21a182c0b /lib/Model
parent0011b18483cebbf2582d6e77a1ac51c79810f523 (diff)
providers is now set in the request, not in the url
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Model')
-rw-r--r--lib/Model/SearchRequest.php30
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/Model/SearchRequest.php b/lib/Model/SearchRequest.php
index 776ee88..4bba3d6 100644
--- a/lib/Model/SearchRequest.php
+++ b/lib/Model/SearchRequest.php
@@ -30,6 +30,9 @@ use OCA\FullNextSearch\Service\MiscService;
class SearchRequest implements \JsonSerializable {
+ /** @var array */
+ private $providers;
+
/** @var string */
private $search;
@@ -48,6 +51,25 @@ class SearchRequest implements \JsonSerializable {
/**
+ * @return array
+ */
+ public function getProviders() {
+ return $this->providers;
+ }
+
+ /**
+ * @param string|array $providers
+ */
+ public function setProviders($providers) {
+ if (!is_array($providers)) {
+ $providers = [$providers];
+ }
+
+ $this->providers = $providers;
+ }
+
+
+ /**
* @return string
*/
public function getSearch() {
@@ -105,9 +127,10 @@ class SearchRequest implements \JsonSerializable {
*/
public function jsonSerialize() {
return [
- 'search' => $this->getSearch(),
- 'page' => $this->getPage(),
- 'size' => $this->getSize()
+ 'providers' => $this->getProviders(),
+ 'search' => $this->getSearch(),
+ 'page' => $this->getPage(),
+ 'size' => $this->getSize()
];
}
@@ -128,6 +151,7 @@ class SearchRequest implements \JsonSerializable {
*/
public static function fromArray($arr) {
$request = new SearchRequest();
+ $request->setProviders($arr['providers']);
$request->setSearch(MiscService::get($arr, 'search', ''));
$request->setPage(MiscService::get($arr, 'page', 0));
$request->setSize(MiscService::get($arr, 'size', 10));