BUGFIX: avoid parsing the markdown to html of each page to index it, simply use plain text for search. BUGFIX: disable notice level errors from Zend when building the index

This commit is contained in:
Will Rossiter 2010-12-21 10:05:24 +00:00
parent 7ec4ae32ad
commit b51421d964

View File

@ -116,7 +116,8 @@ class DocumentationSearch {
'Title' => DBField::create('Varchar', $data->Title),
'Link' => DBField::create('Varchar',$data->Path),
'Language' => DBField::create('Varchar',$data->Language),
'Version' => DBField::create('Varchar',$data->Version)
'Version' => DBField::create('Varchar',$data->Version),
'Content' => DBField::create('Text', $data->content)
)));
}
}
@ -172,14 +173,22 @@ class DocumentationSearch {
foreach($pages as $page) {
$count++;
// iconv complains about all the markdown formatting
// turn off notices while we parse
$error = error_reporting();
error_reporting('E_ALL ^ E_NOTICE');
if(!is_dir($page->getPath())) {
$doc = Zend_Search_Lucene_Document_Html::loadHTML($page->getHtml());
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Text('content', $page->getMarkdown()));
$doc->addField(Zend_Search_Lucene_Field::Text('Title', $page->getTitle()));
$doc->addField(Zend_Search_Lucene_Field::Keyword('Version', $page->getVersion()));
$doc->addField(Zend_Search_Lucene_Field::Keyword('Language', $page->getLang()));
$doc->addField(Zend_Search_Lucene_Field::Keyword('Path', $page->getPath()));
$index->addDocument($doc);
}
error_reporting($error);
}
}