diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-03-01 10:29:17 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-03-04 09:54:45 -0100 |
commit | 4ac0375f89cdbfc8ae7fc8d199cf0dd55079cb8a (patch) | |
tree | fea91318f5092e773555e6f2630f93f39cb651d5 /lib/private/FullTextSearch/Model | |
parent | 83d70d9008b2b2ddc831d71865066ed06180cb0a (diff) | |
download | nextcloud-server-4ac0375f89cdbfc8ae7fc8d199cf0dd55079cb8a.tar.gz nextcloud-server-4ac0375f89cdbfc8ae7fc8d199cf0dd55079cb8a.zip |
cleaning the excerpts managment
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/private/FullTextSearch/Model')
-rw-r--r-- | lib/private/FullTextSearch/Model/IndexDocument.php | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/private/FullTextSearch/Model/IndexDocument.php b/lib/private/FullTextSearch/Model/IndexDocument.php index fec140c81a0..55cce902a28 100644 --- a/lib/private/FullTextSearch/Model/IndexDocument.php +++ b/lib/private/FullTextSearch/Model/IndexDocument.php @@ -671,12 +671,11 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * @return IIndexDocument */ final public function addExcerpt(string $source, string $excerpt): IIndexDocument { - $excerpt = $this->cleanExcerpt($excerpt); - if (!array_key_exists($source, $this->excerpts)) { - $this->excerpts[$source] = []; - } - - $this->excerpts[$source][] = $excerpt; + $this->excerpts[] = + [ + 'source' => $source, + 'excerpt' => $this->cleanExcerpt($excerpt) + ]; return $this; } @@ -694,13 +693,9 @@ class IndexDocument implements IIndexDocument, JsonSerializable { final public function setExcerpts(array $excerpts): IIndexDocument { $new = []; foreach ($excerpts as $entry) { - $newExcerpts = array_map(function (string $excerpt): string { - return $this->cleanExcerpt($excerpt); - }, $entry['excerpt']); - $new[] = [ 'source' => $entry['source'], - 'excerpt' => $newExcerpts + 'excerpt' => $this->cleanExcerpt($entry['excerpt']) ]; } |