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
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-05-07 20:21:43 +0300
committerMaxence Lange <maxence@artificial-owl.com>2018-05-07 20:21:43 +0300
commitc7173dce00ace8c9827d7bed96affaaef91bf55c (patch)
treebba5be7a1f7d20537f190942c395109f78177b0c
parent780bd60270f53c46be9781289af6348703be6771 (diff)
add parts to index/search
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/Model/IndexDocument.php34
-rw-r--r--lib/Model/SearchRequest.php24
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', []));