diff options
-rw-r--r-- | lib/Model/IndexDocument.php | 34 | ||||
-rw-r--r-- | lib/Model/SearchRequest.php | 24 |
2 files changed, 58 insertions, 0 deletions
diff --git a/lib/Model/IndexDocument.php b/lib/Model/IndexDocument.php index 4a1bc39..dbdfa88 100644 --- a/lib/Model/IndexDocument.php +++ b/lib/Model/IndexDocument.php @@ -59,6 +59,9 @@ class IndexDocument implements \JsonSerializable { /** @var string */ public $content = null; + /** @var array */ + public $parts = []; + /** @var string */ public $link = ''; @@ -273,6 +276,37 @@ class IndexDocument implements \JsonSerializable { /** + * @param string $part + * @param string $content + * + * @return $this + */ + public function setPart($part, $content) { + $this->parts[$part] = $content; + + return $this; + } + + /** + * @param array $parts + * + * @return $this + */ + public function setParts($parts) { + $this->parts = $parts; + + return $this; + } + + /** + * @return array + */ + public function getParts() { + return $this->parts; + } + + + /** * @return int */ public function isContentEncoded() { diff --git a/lib/Model/SearchRequest.php b/lib/Model/SearchRequest.php index e0d6a05..6da3747 100644 --- a/lib/Model/SearchRequest.php +++ b/lib/Model/SearchRequest.php @@ -52,6 +52,9 @@ class SearchRequest implements \JsonSerializable { private $options; /** @var array */ + private $parts = []; + + /** @var array */ private $wildcardQueries = []; /** @var array */ @@ -184,6 +187,25 @@ class SearchRequest implements \JsonSerializable { /** + * @param array $parts + * + * @return $this + */ + public function setParts($parts) { + $this->parts = $parts; + + return $this; + } + + /** + * @return array + */ + public function getParts() { + return $this->parts; + } + + + /** * @param string $tag */ public function addTag($tag) { @@ -305,6 +327,7 @@ class SearchRequest implements \JsonSerializable { 'search' => $this->getSearch(), 'page' => $this->getPage(), 'size' => $this->getSize(), + 'parts' => $this->getParts(), 'options' => $this->getOptions(), 'tags' => $this->getTags() ]; @@ -331,6 +354,7 @@ class SearchRequest implements \JsonSerializable { $request->setAuthor(MiscService::get($arr, 'author', '')); $request->setSearch(MiscService::get($arr, 'search', '')); $request->setPage(MiscService::get($arr, 'page', 0)); + $request->setParts(MiscService::get($arr, 'parts', [])); $request->setSize(MiscService::get($arr, 'size', 10)); $request->setOptions(MiscService::get($arr, 'options', [])); $request->setTags(MiscService::get($arr, 'tags', [])); |