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
path: root/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-07-28 22:48:21 +0300
committerMaxence Lange <maxence@artificial-owl.com>2018-07-28 22:48:21 +0300
commit82c568b65649187ba747046d23e40558b30fce8e (patch)
treed17d0076ee125374e51f3cd033dcad6fdcd4fee4 /lib
parentfb4362d02d416d32eb46030b2140af91c8c12dd4 (diff)
fix result display
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Command/DocumentProvider.php27
-rw-r--r--lib/Model/IndexDocument.php1
2 files changed, 18 insertions, 10 deletions
diff --git a/lib/Command/DocumentProvider.php b/lib/Command/DocumentProvider.php
index db3999a..c672f81 100644
--- a/lib/Command/DocumentProvider.php
+++ b/lib/Command/DocumentProvider.php
@@ -95,18 +95,25 @@ class DocumentProvider extends ExtendedBase {
$index->setOwnerId($userId);
$index->setStatus(Index::INDEX_FULL);
$indexDocument = $provider->updateDocument($index);
- $result = [
- 'document' => $indexDocument
- ];
- if ($input->getOption('content') === true) {
- $content = $indexDocument->getContent();
- if ($indexDocument->isContentEncoded() === IndexDocument::ENCODED_BASE64) {
- $content = base64_decode($content);
- }
- $result['content'] = substr($content, 0, 200);
+ if ($indexDocument->getIndex()
+ ->isStatus(Index::INDEX_REMOVE)) {
+ throw new Exception('Unknown document');
}
+
+ $output->writeln('Document: ');
+ $output->writeln(json_encode($indexDocument, JSON_PRETTY_PRINT));
- $output->writeln(json_encode($result, JSON_PRETTY_PRINT));
+ if ($input->getOption('content') !== true) {
+ return;
+ }
+
+ $output->writeln('Content: ');
+ $content = $indexDocument->getContent();
+ if ($indexDocument->isContentEncoded() === IndexDocument::ENCODED_BASE64) {
+ $content = base64_decode($content, true);
+ }
+
+ $output->writeln(substr($content, 0, 60));
}
diff --git a/lib/Model/IndexDocument.php b/lib/Model/IndexDocument.php
index 3fa45c9..92bb7d5 100644
--- a/lib/Model/IndexDocument.php
+++ b/lib/Model/IndexDocument.php
@@ -532,6 +532,7 @@ class IndexDocument implements \JsonSerializable {
'modifiedTime' => $this->getModifiedTime(),
'title' => $this->getTitle(),
'link' => $this->getLink(),
+ 'index' => $this->getIndex(),
'source' => $this->getSource(),
'info' => $this->getInfoAll(),
'hash' => $this->getHash(),