Yii is carefully designed so that third-party libraries can be
easily integrated to further extend Yii's functionalities.
When using third-party libraries in a project, developers often
encounter issues about class naming and file inclusion.
Because all Yii classes are prefixed with letter
C, it is less
likely class naming issue would occur; and because Yii relies on
to perform class file inclusion, it can play nicely with other libraries
if they use the same autoloading feature or PHP include path to include
First, we extract the Zend framework release file to a directory
protected is the
application base directory.
Verify that the file
Second, at the beginning of a controller class file, insert the following lines:
The above code includes the class file
Lucene.php. Because we are using
a relative path, we need to change the PHP include path so that the file
can be located correctly. This is done by calling
Once the above set up is ready, we can use the
Lucene class in a controller action,
like the following:
$lucene=new Zend_Search_Lucene($pathOfIndex); $hits=$lucene->find(strtolower($keyword));