- do some checks if document has version

This commit is contained in:
steinm 2012-09-13 13:58:49 +00:00
parent 1b5017cf38
commit 7a65e47cb5

View File

@ -39,11 +39,13 @@ class LetoDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
if($convcmd) { if($convcmd) {
$_convcmd = $convcmd; $_convcmd = $convcmd;
} }
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
$version = $document->getLatestContent(); $version = $document->getLatestContent();
$this->addField(Zend_Search_Lucene_Field::Keyword('document_id', $document->getID())); $this->addField(Zend_Search_Lucene_Field::Keyword('document_id', $document->getID()));
if($version) {
$this->addField(Zend_Search_Lucene_Field::Keyword('mimetype', $version->getMimeType())); $this->addField(Zend_Search_Lucene_Field::Keyword('mimetype', $version->getMimeType()));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('created', $version->getDate())); $this->addField(Zend_Search_Lucene_Field::UnIndexed('created', $version->getDate()));
}
$this->addField(Zend_Search_Lucene_Field::Text('title', $document->getName())); $this->addField(Zend_Search_Lucene_Field::Text('title', $document->getName()));
if($categories = $document->getCategories()) { if($categories = $document->getCategories()) {
$names = array(); $names = array();
@ -60,6 +62,7 @@ class LetoDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
if($comment = $document->getComment()) { if($comment = $document->getComment()) {
$this->addField(Zend_Search_Lucene_Field::Text('comment', $comment)); $this->addField(Zend_Search_Lucene_Field::Text('comment', $comment));
} }
if($version) {
$path = $dms->contentDir . $version->getPath(); $path = $dms->contentDir . $version->getPath();
$content = ''; $content = '';
$fp = null; $fp = null;
@ -79,5 +82,6 @@ class LetoDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
} }
} }
} }
}
} }
?> ?>