Commit 3c79cecb1ab4e5401b34e476edff3881da11afbc
1 parent
a73a2621
KTS-673
"The search algorithm needs some work" Updated. Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7471 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
13 additions
and
7 deletions
search2/indexing/extractors/OOTextExtractor.inc.php
| @@ -2,14 +2,16 @@ | @@ -2,14 +2,16 @@ | ||
| 2 | 2 | ||
| 3 | class OOTextExtractor extends ExternalDocumentExtractor | 3 | class OOTextExtractor extends ExternalDocumentExtractor |
| 4 | { | 4 | { |
| 5 | - private $python; | ||
| 6 | - private $documentConverter; | ||
| 7 | - private $ooHost; | ||
| 8 | - private $ooPort; | 5 | + protected $python; |
| 6 | + protected $documentConverter; | ||
| 7 | + protected $ooHost; | ||
| 8 | + protected $ooPort; | ||
| 9 | + protected $targetExtension; | ||
| 9 | 10 | ||
| 10 | - public function __construct($targetMimeType='plain/text') | 11 | + public function __construct($targetExtension='html') |
| 11 | { | 12 | { |
| 12 | parent::__construct(); | 13 | parent::__construct(); |
| 14 | + $this->targetExtension = $targetExtension; | ||
| 13 | $config =& KTConfig::getSingleton(); | 15 | $config =& KTConfig::getSingleton(); |
| 14 | 16 | ||
| 15 | $this->python = KTUtil::findCommand('externalBinary/python'); | 17 | $this->python = KTUtil::findCommand('externalBinary/python'); |
| @@ -46,12 +48,12 @@ class OOTextExtractor extends ExternalDocumentExtractor | @@ -46,12 +48,12 @@ class OOTextExtractor extends ExternalDocumentExtractor | ||
| 46 | { | 48 | { |
| 47 | $sourcefile = escapeshellcmd($this->sourcefile); | 49 | $sourcefile = escapeshellcmd($this->sourcefile); |
| 48 | unlink($this->targetfile); | 50 | unlink($this->targetfile); |
| 49 | - $this->targetfile .= '.html'; | 51 | + $this->targetfile .= '.' . $this->targetExtension; |
| 50 | $targetfile = escapeshellcmd($this->targetfile); | 52 | $targetfile = escapeshellcmd($this->targetfile); |
| 51 | 53 | ||
| 52 | $escape = OS_WINDOWS?'"':'\''; | 54 | $escape = OS_WINDOWS?'"':'\''; |
| 53 | 55 | ||
| 54 | - $cmdline = "{$this->python} {$escape}{$this->documentConverter}{$escape} {$escape}{$this->sourcefile}{$escape} {$escape}{$this->targetfile}{$escape} {$this->ooHost} {$this->ooPort}"; | 56 | + $cmdline = "{$this->python} {$escape}{$this->documentConverter}{$escape} {$escape}{$sourcefile}{$escape} {$escape}{$targetfile}{$escape} {$this->ooHost} {$this->ooPort}"; |
| 55 | return $cmdline; | 57 | return $cmdline; |
| 56 | } | 58 | } |
| 57 | 59 | ||
| @@ -80,6 +82,10 @@ class OOTextExtractor extends ExternalDocumentExtractor | @@ -80,6 +82,10 @@ class OOTextExtractor extends ExternalDocumentExtractor | ||
| 80 | return false; | 82 | return false; |
| 81 | } | 83 | } |
| 82 | 84 | ||
| 85 | + if ($this->targetExtension != 'html') | ||
| 86 | + { | ||
| 87 | + return true; | ||
| 88 | + } | ||
| 83 | $content = file_get_contents($this->targetfile); | 89 | $content = file_get_contents($this->targetfile); |
| 84 | return file_put_contents($this->targetfile, $this->filter($content)); | 90 | return file_put_contents($this->targetfile, $this->filter($content)); |
| 85 | 91 |