CakePHP with Lucene

大憨熊 提交于 2019-12-06 09:35:27

问题


I am trying to implement Lucene with cakephp and following this guide http://jamienay.com/2010/01/zend_search_lucene-datasource-for-cakephp/

Am getting this error

ConnectionManager::loadDataSource - Unable to import DataSource class .ZendSearchLuceneSource

i have placed the Vendor files in app/vendors/Zend/

Added this in the bootstrap.php

ini_set('include_path', ini_get('include_path') . ':' . CAKE_CORE_INCLUDE_PATH . DS . '/vendors');

/**
 * AutoLoading Zend Vendor Files
 */
function __autoload($path) {
    if(substr($path, 0, 5) == 'Zend_') {
        include str_replace('_', '/', $path) . '.php';
    }
    return $path;
}

added this to the Database Config

var $zendSearchLucene = array(
    'datasource' => 'ZendSearchLucene',
    'indexFile' => 'lucene', // stored in the cache dir.
    'driver' => '',
    'source' => 'search_indices'
);

Add created a model called search.php

<?php
class Search extends AppModel {
    var $useDbConfig = 'zendSearchLucene';

}
?>

Right now i have created a controller called search too like this

<?php
class SearchController extends AppController {

    var $name = 'Search';

    function index(){

    }


}
?>

when i visit site/search am getting that error.


回答1:


Not sure if this is still relevant to you, but I have just begun using the same datasource and came across the same issues. I updated the datasource for Cake 1.3 and it should work now.

Have a look at my fork of the project at Github:
https://github.com/deceze/zend_search_lucene_source

If you find any problems with it, please open tickets for them. I'll see if I can get around to fixing them. The datasource is a good basis, but may need some updating and extension.



来源:https://stackoverflow.com/questions/4119124/cakephp-with-lucene

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!