diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-11-01 17:38:43 +0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2018-11-01 17:38:43 +0100 |
commit | 45285eca6a7edb353aaaa0cb28a8028984eacf61 (patch) | |
tree | 7a975338a0d4778195aa387d681c19b741f8e6e7 /lib | |
parent | 35a7ea869e4d63761e4a11c3d96a77a6a5e3418f (diff) | |
download | nextcloud-server-45285eca6a7edb353aaaa0cb28a8028984eacf61.tar.gz nextcloud-server-45285eca6a7edb353aaaa0cb28a8028984eacf61.zip |
+infoBool / +infoInt
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/FullTextSearch/Model/IndexDocument.php | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/lib/public/FullTextSearch/Model/IndexDocument.php b/lib/public/FullTextSearch/Model/IndexDocument.php index a73b702e506..f580a69a063 100644 --- a/lib/public/FullTextSearch/Model/IndexDocument.php +++ b/lib/public/FullTextSearch/Model/IndexDocument.php @@ -819,6 +819,82 @@ class IndexDocument implements JsonSerializable { } /** + * Set some information about the original document that will be available + * to the front-end when displaying search result. (as int) + * Because this information will not be indexed, this method can also be + * used to manage some data while filling the IndexDocument before its + * indexing. + * + * @since 15.0.0 + * + * @param string $info + * @param int $value + * + * @return IndexDocument + */ + final public function setInfoInt(string $info, int $value): IndexDocument { + $this->info[$info] = $value; + + return $this; + } + + /** + * Get an information about a document. (int) + * + * @since 15.0.0 + * + * @param string $info + * @param int $default + * + * @return int + */ + final public function getInfoInt(string $info, int $default = 0): int { + if (!key_exists($info, $this->info)) { + return $default; + } + + return $this->info[$info]; + } + + /** + * Set some information about the original document that will be available + * to the front-end when displaying search result. (as bool) + * Because this information will not be indexed, this method can also be + * used to manage some data while filling the IndexDocument before its + * indexing. + * + * @since 15.0.0 + * + * @param string $info + * @param bool $value + * + * @return IndexDocument + */ + final public function setInfoBool(string $info, bool $value): IndexDocument { + $this->info[$info] = $value; + + return $this; + } + + /** + * Get an information about a document. (bool) + * + * @since 15.0.0 + * + * @param string $info + * @param bool $default + * + * @return bool + */ + final public function getInfoBool(string $info, bool $default = false): bool { + if (!key_exists($info, $this->info)) { + return $default; + } + + return $this->info[$info]; + } + + /** * Get all info. * * @since 15.0.0 |