summaryrefslogtreecommitdiffstats
path: root/lib/private/FullTextSearch/Model
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-03-01 10:29:17 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-03-04 09:54:45 -0100
commit4ac0375f89cdbfc8ae7fc8d199cf0dd55079cb8a (patch)
treefea91318f5092e773555e6f2630f93f39cb651d5 /lib/private/FullTextSearch/Model
parent83d70d9008b2b2ddc831d71865066ed06180cb0a (diff)
downloadnextcloud-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.php17
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'])
];
}