From b51421d964e476600341db293357446ebb5e9001 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Tue, 21 Dec 2010 10:05:24 +0000 Subject: [PATCH] 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 --- code/DocumentationSearch.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/code/DocumentationSearch.php b/code/DocumentationSearch.php index 7f839ca..b793142 100644 --- a/code/DocumentationSearch.php +++ b/code/DocumentationSearch.php @@ -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); } }