20.11.2014 Views

O Guia Definitivo do Yii 1.1

O Guia Definitivo do Yii 1.1

O Guia Definitivo do Yii 1.1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Second, at the beginning of a controller class file, insert the following lines:<br />

<strong>Yii</strong>::import('application.ven<strong>do</strong>rs.*');<br />

require_once('Zend/Search/Lucene.php');<br />

The above code includes the class file Lucene.php. Because we are using a relative path,<br />

we need to change the PHP include path so that the file can be located correctly. This is<br />

<strong>do</strong>ne by calling <strong>Yii</strong>::importbefore require_once.<br />

Once the above set up is ready, we can use the Lucene class in a controller action, like the<br />

following:<br />

$lucene=new Zend_Search_Lucene($pathOfIndex);<br />

$hits=$lucene->find(strtolower($keyword));

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!