2010-11-07 44 views
2

我試圖使用CakePHP實現Lucene和本指南 http://jamienay.com/2010/01/zend_search_lucene-datasource-for-cakephp/CakePHP的使用Lucene

正在此錯誤

的ConnectionManager :: loadDataSource以下 - 無法導入數據源類.ZendSearchLuceneSource

我有將賣家文件放在app/vendors/Zend/

在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; 
} 

已將此添加到數據庫配置

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

添加創建了一個名爲的search.php

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

} 
?> 

眼下模型我創建了一個名爲控制器搜索過這樣

<?php 
class SearchController extends AppController { 

    var $name = 'Search'; 

    function index(){ 

    } 


} 
?> 

當我訪問網站/搜索獲取該錯誤。

+0

已經做到了這一點,也複製zend_search_lucene.php模型/ datasources – 2010-11-07 18:48:02

回答

2

不知道這是否仍然與您有關,但我剛開始使用相同的數據源並遇到相同的問題。我更新了Cake 1.3的數據源,它現在應該可以工作。

看一看我的項目的叉子Github上:
https://github.com/deceze/zend_search_lucene_source

如果您發現任何問題,請open tickets他們。我會看看我是否可以解決它們。數據源是一個很好的基礎,但可能需要一些更新和擴展。

+0

非常感謝。將研究它,並接近你:D – 2010-12-02 17:33:29