From 30a6cfdd7907d27b58b268afe6b31a8c49770bd4 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 21 Sep 2023 11:26:03 +0200 Subject: [PATCH] wait #6188 @0.25 --- app/Fluidbook/SEO/Document.php | 2 +- app/Models/FluidbookDocument.php | 4 ++++ app/Models/FluidbookPublication.php | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Fluidbook/SEO/Document.php b/app/Fluidbook/SEO/Document.php index 112d128fe..a01c67386 100644 --- a/app/Fluidbook/SEO/Document.php +++ b/app/Fluidbook/SEO/Document.php @@ -118,7 +118,7 @@ class Document public function getTextContent($page) { - $f = $this->compiler->getFluidbook()->getTextFile($page, FluidbookDocument::TEXT_HTML); + $f = $this->compiler->getFluidbook()->getTextFile($page, FluidbookDocument::TEXT_HTML, 'standard'); $res = trim(file_get_contents($f)); if (!str_starts_with($res, '
')) { diff --git a/app/Models/FluidbookDocument.php b/app/Models/FluidbookDocument.php index e013927e2..3641374f8 100644 --- a/app/Models/FluidbookDocument.php +++ b/app/Models/FluidbookDocument.php @@ -406,6 +406,10 @@ class FluidbookDocument extends ToolboxModel $sepFolder = 'sep_' . md5($ignoreSeparators) . '/'; } + if ($mode === 'robust') { + $extractionMethod = 'fluidbook'; + } + $prefix = self::_getTextFilePrefix($extractionMethod); $dir = $mode !== 'standard' ? $mode . '/' : ''; return $this->path('texts/' . $dir . $sepFolder) . $prefix . $type . $page . '.txt'; diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index aff48a084..3da16f38d 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -396,10 +396,10 @@ class FluidbookPublication extends ToolboxSettingsModel return self::$_docs[$documentID]; } - public function getTextFile($page, $type = FluidbookDocument::TEXT_PLAIN) + public function getTextFile($page, $type = FluidbookDocument::TEXT_PLAIN, $mode = null) { $compo = $this->getComposition()[$page]; - return self::_getDocument($compo[0])->getTextFile($compo[1], $type, $this->search_mode ?: 'standard', $this->textExtraction, $this->ignoreSearchSeparators); + return self::_getDocument($compo[0])->getTextFile($compo[1], $type, $mode ?? $this->search_mode ?: 'standard', $this->textExtraction, $this->ignoreSearchSeparators); } public function getHightlightFile($page) @@ -436,7 +436,7 @@ class FluidbookPublication extends ToolboxSettingsModel try { return Farm::getFileFromPDF($thumbpdf, $page, $format, $resolution, $this->JPEGQuality, $withText, $withGraphics, $version, null, $force, 1); } catch (\Exception $e) { - throw new \Exception('Unable to generate thumbnails file from custom PDF "' . $this->pdfThumbnails . '" (original message : ' . $e->getMessage().')'); + throw new \Exception('Unable to generate thumbnails file from custom PDF "' . $this->pdfThumbnails . '" (original message : ' . $e->getMessage() . ')'); } } else { } -- 2.39.5