Lucene - Indexing

Hi Guys,

I have a little Problem with Lucene and I hope that somebody has a solution for this.

I integrated the Lucene System into my Yii project and everthing works well

(Search and so on).

I wanted to index all phtml Files for the Search.

My question: Is there a function to get all the View files from a project or directory?

I can do this with a Iterator myself but if there is a core function, that would be better.

Thanks for ideas

Jan




        $docs = array('http://localhost/yii/homepage/index.php?r=site/index');

        foreach ($docs as $doc) {

            $document = new Zend_Search_Lucene_Document();

            $document = Zend_Search_Lucene_Document_Html::loadHTMLFile($doc);

            $document->addField(Zend_Search_Lucene_Field::unStored('id', $doc));

            $document->addField(Zend_Search_Lucene_Field::Text('url', $doc));

            $document->addField(Zend_Search_Lucene_Field::Text('title', $document->title));

            $document->addField(Zend_Search_Lucene_Field::Text('content', $document->body));

            //$document->addField(Zend_Search_Lucene_Field::Text('language', $document->language));            

            $index->addDocument($document);

            $index->commit();

        }



You can use CController::viewPath to get the path to the views of the current controller if you need it. Use CFileHelper::findFiles() to get an array of all of the files in a given directory (and sub-directories).

I hope this helps :)

Hi,

yes I think that is help enough. Together with the fact that I use themes, this is a good solution.

Greetings Jan